Phone numbers in tel: URLs contain spaces in contravention of RFC3966 #9822

Closed
opened 2025-12-29 21:23:10 +01:00 by adam · 2 comments
Owner

Originally created by @pv2b on GitHub (Jun 10, 2024).

Originally assigned to: @arthanson on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.0.3

Python Version

3.11

Steps to Reproduce

  1. Set the phone number for a contact to a number with spaces, e.x. +1 800 123 45 67
  2. Go to the contact detail page and hover over the phone number, and observe the link generated. (This also applies to the contact list table.)

Expected Behavior

The URL generated should be tel:+18001234567, removing spaces as per RFC3966 section 5.1.1:

However, even though ITU-T E.123 [E.123] recommends the use of space characters as visual separators in printed telephone numbers, "tel" URIs MUST NOT use spaces in visual separators to avoid excessive escaping.

Observed Behavior

The URL generated is actually tel:+1 800 123 45 67 which neither strips nor URL-encodes the spaces.

Inspecting the HTML code would show something like:

<a href="tel:+1 800 123 45 67">+1 800 123 45 67</a>
Originally created by @pv2b on GitHub (Jun 10, 2024). Originally assigned to: @arthanson on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.0.3 ### Python Version 3.11 ### Steps to Reproduce 1. Set the phone number for a contact to a number with spaces, e.x. `+1 800 123 45 67` 2. Go to the contact detail page and hover over the phone number, and observe the link generated. (This also applies to the contact list table.) ### Expected Behavior The URL generated should be `tel:+18001234567`, removing spaces as per [RFC3966 section 5.1.1](https://www.rfc-editor.org/rfc/rfc3966#section-5.1.1): > However, even though ITU-T E.123 [[E.123](https://www.rfc-editor.org/rfc/rfc3966#ref-E.123)] recommends the use of space characters as visual separators in printed telephone numbers, "tel" URIs MUST NOT use spaces in visual separators to avoid excessive escaping. ### Observed Behavior The URL generated is actually `tel:+1 800 123 45 67` which neither strips nor URL-encodes the spaces. Inspecting the HTML code would show something like: ``` <a href="tel:+1 800 123 45 67">+1 800 123 45 67</a> ```
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:23:10 +01:00
adam closed this issue 2025-12-29 21:23:10 +01:00
Author
Owner

@pv2b commented on GitHub (Jun 10, 2024):

The relevant function to change looks like it's here: 56b6b1b9d8/netbox/utilities/tables.py (L26-L32)

@pv2b commented on GitHub (Jun 10, 2024): The relevant function to change looks like it's here: https://github.com/netbox-community/netbox/blob/56b6b1b9d864a12d05b8cd6d9f4f1a476fa00e85/netbox/utilities/tables.py#L26-L32
Author
Owner

@pv2b commented on GitHub (Jun 10, 2024):

Can confirm this is still present in v4.0.5

@pv2b commented on GitHub (Jun 10, 2024): Can confirm this is still present in v4.0.5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9822