Explorar o código

Fixes #9503: Hyperlinks in ack elevation SVGs must always use absolute URLs

jeremystretch %!s(int64=3) %!d(string=hai) anos
pai
achega
2815eca260
Modificáronse 2 ficheiros con 6 adicións e 5 borrados
  1. 1 0
      docs/release-notes/version-3.2.md
  2. 5 5
      netbox/dcim/svg.py

+ 1 - 0
docs/release-notes/version-3.2.md

@@ -18,6 +18,7 @@
 * [#9484](https://github.com/netbox-community/netbox/issues/9484) - Include services listening on "all IPs" under IP address view
 * [#9486](https://github.com/netbox-community/netbox/issues/9486) - Fix redirect URL when adding device components from the module view
 * [#9495](https://github.com/netbox-community/netbox/issues/9495) - Correct link to contacts in contact groups table column
+* [#9503](https://github.com/netbox-community/netbox/issues/9503) - Hyperlinks in ack elevation SVGs must always use absolute URLs
 * [#9512](https://github.com/netbox-community/netbox/issues/9512) - Fix duplicate site results when searching by ASN
 * [#9524](https://github.com/netbox-community/netbox/issues/9524) - Correct order of VLAN fields under VM interface creation form
 * [#9537](https://github.com/netbox-community/netbox/issues/9537) - Ensure consistent use of placeholder tag throughout UI

+ 5 - 5
netbox/dcim/svg.py

@@ -114,7 +114,7 @@ class RackElevationSVG:
         # Embed front device type image if one exists
         if self.include_images and device.device_type.front_image:
             image = drawing.image(
-                href=device.device_type.front_image.url,
+                href='{}{}'.format(self.base_url, device.device_type.front_image.url),
                 insert=start,
                 size=end,
                 class_='device-image'
@@ -140,7 +140,7 @@ class RackElevationSVG:
         # Embed rear device type image if one exists
         if self.include_images and device.device_type.rear_image:
             image = drawing.image(
-                href=device.device_type.rear_image.url,
+                href='{}{}'.format(self.base_url, device.device_type.rear_image.url),
                 insert=start,
                 size=end,
                 class_='device-image'
@@ -151,9 +151,9 @@ class RackElevationSVG:
                      stroke_width='0.2em', stroke_linejoin='round', class_='device-image-label'))
             link.add(drawing.text(get_device_name(device), insert=text, fill='white', class_='device-image-label'))
 
-    @staticmethod
-    def _draw_empty(drawing, rack, start, end, text, id_, face_id, class_, reservation):
-        link_url = '{}?{}'.format(
+    def _draw_empty(self, drawing, rack, start, end, text, id_, face_id, class_, reservation):
+        link_url = '{}{}?{}'.format(
+            self.base_url,
             reverse('dcim:device_add'),
             urlencode({
                 'site': rack.site.pk,