Custom links with variables use improper URL encoding when spaces are included in the site name #8169

Closed
opened 2025-12-29 20:33:22 +01:00 by adam · 2 comments
Owner

Originally created by @purgeitall on GitHub (Jun 6, 2023).

Originally assigned to: @abhi1693 on GitHub.

NetBox version

v3.5.3

Python version

3.10

Steps to Reproduce

  1. Create site with space in it - Example: "Test Site"
  2. Create custom link with content type "DCIM: Site".
  3. In the link url, use format: https://www.website.com/anything/{{object.name}}

Expected Behavior

When the link is selected, the variable should be replaced with "test site". proper URL encoding would look like this:

https://www.website.com/anything/test%20site

Observed Behavior

The link sends me to this URL which is what would be used when submitting a query. This may work for some URLs but with sharepoint all our links are now invalid.

https://www.website.com/anything/test+site

Originally created by @purgeitall on GitHub (Jun 6, 2023). Originally assigned to: @abhi1693 on GitHub. ### NetBox version v3.5.3 ### Python version 3.10 ### Steps to Reproduce 1. Create site with space in it - Example: "Test Site" 2. Create custom link with content type "DCIM: Site". 3. In the link url, use format: https://www.website.com/anything/{{object.name}} ### Expected Behavior When the link is selected, the variable should be replaced with "test site". proper URL encoding would look like this: https://www.website.com/anything/test%20site ### Observed Behavior The link sends me to this URL which is what would be used when submitting a query. This may work for some URLs but with sharepoint all our links are now invalid. https://www.website.com/anything/test+site
adam added the type: bugstatus: accepted labels 2025-12-29 20:33:22 +01:00
adam closed this issue 2025-12-29 20:33:23 +01:00
Author
Owner

@DanSheps commented on GitHub (Jun 6, 2023):

According to @candlerb in this discussion: https://github.com/netbox-community/netbox/discussions/12815#discussioncomment-6094350

This appears to be a bug, whether it is in our code or a library we use is the next question. If someone wants to take a crack at it. Feel free.

@DanSheps commented on GitHub (Jun 6, 2023): According to @candlerb in this discussion: https://github.com/netbox-community/netbox/discussions/12815#discussioncomment-6094350 This appears to be a bug, whether it is in our code or a library we use is the next question. If someone wants to take a crack at it. Feel free.
Author
Owner

@ibplayn commented on GitHub (Jun 20, 2023):

Could i suggest adding a semi-colon to safe string so that this:
https://website.com/dashboard?mode=device%3Bdevice_list=devicename

becomes this instead:
https://website.com/dashboard?mode=device;device_list=devicename

It was working on 3.4.X but seems to have broke in 3.5.2-4

Thanks!

@ibplayn commented on GitHub (Jun 20, 2023): Could i suggest adding a semi-colon to safe string so that this: https://website.com/dashboard?mode=device%3Bdevice_list=devicename becomes this instead: https://website.com/dashboard?mode=device;device_list=devicename It was working on 3.4.X but seems to have broke in 3.5.2-4 Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8169