mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Merge pull request #9750 from smuth4/fix/broken-image-urls
Fixes #9634: Respect image URLs which are already fully formed
This commit is contained in:
commit
124ff23e3d
@ -113,8 +113,12 @@ class RackElevationSVG:
|
|||||||
|
|
||||||
# Embed front device type image if one exists
|
# Embed front device type image if one exists
|
||||||
if self.include_images and device.device_type.front_image:
|
if self.include_images and device.device_type.front_image:
|
||||||
|
url = device.device_type.front_image.url
|
||||||
|
# Convert any relative URLs to absolute
|
||||||
|
if url.startswith('/'):
|
||||||
|
url = '{}{}'.format(self.base_url, url)
|
||||||
image = drawing.image(
|
image = drawing.image(
|
||||||
href='{}{}'.format(self.base_url, device.device_type.front_image.url),
|
href=url,
|
||||||
insert=start,
|
insert=start,
|
||||||
size=end,
|
size=end,
|
||||||
class_='device-image'
|
class_='device-image'
|
||||||
@ -139,8 +143,12 @@ class RackElevationSVG:
|
|||||||
|
|
||||||
# Embed rear device type image if one exists
|
# Embed rear device type image if one exists
|
||||||
if self.include_images and device.device_type.rear_image:
|
if self.include_images and device.device_type.rear_image:
|
||||||
|
url = device.device_type.rear_image.url
|
||||||
|
# Convert any relative URLs to absolute
|
||||||
|
if url.startswith('/'):
|
||||||
|
url = '{}{}'.format(self.base_url, url)
|
||||||
image = drawing.image(
|
image = drawing.image(
|
||||||
href='{}{}'.format(self.base_url, device.device_type.rear_image.url),
|
href=url,
|
||||||
insert=start,
|
insert=start,
|
||||||
size=end,
|
size=end,
|
||||||
class_='device-image'
|
class_='device-image'
|
||||||
|
Loading…
Reference in New Issue
Block a user