From 38172b793b3fa51025187901a8302d5503d64c33 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 21 Sep 2021 15:04:37 -0400 Subject: [PATCH] Fixes #7294: Fix SVG rendering for cable traces ending at unoccupied front ports --- docs/release-notes/version-3.0.md | 1 + netbox/dcim/models/device_components.py | 9 ++++----- netbox/dcim/svg.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 7f9eafc47..545db1049 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -9,6 +9,7 @@ ### Bug Fixes +* [#7294](https://github.com/netbox-community/netbox/issues/7294) - Fix SVG rendering for cable traces ending at unoccupied front ports * [#7321](https://github.com/netbox-community/netbox/issues/7321) - Don't overwrite multi-select custom fields during bulk edit * [#7324](https://github.com/netbox-community/netbox/issues/7324) - Fix TypeError exception in web UI when filtering objects using single-choice filters * [#7333](https://github.com/netbox-community/netbox/issues/7333) - Prevent inadvertent deletion of prior change records when deleting objects diff --git a/netbox/dcim/models/device_components.py b/netbox/dcim/models/device_components.py index 6a81e2cf1..a321c8059 100644 --- a/netbox/dcim/models/device_components.py +++ b/netbox/dcim/models/device_components.py @@ -185,11 +185,10 @@ class PathEndpoint(models.Model): # Construct the complete path path = [self, *self._path.get_path()] - if self._path.destination: - path.append(self._path.destination) - while len(path) % 3: - # Pad to ensure we have complete three-tuples (e.g. for paths that end at a RearPort) - path.insert(-1, None) + while (len(path) + 1) % 3: + # Pad to ensure we have complete three-tuples (e.g. for paths that end at a non-connected FrontPort) + path.append(None) + path.append(self._path.destination) # Return the path as a list of three-tuples (A termination, cable, B termination) return list(zip(*[iter(path)] * 3)) diff --git a/netbox/dcim/svg.py b/netbox/dcim/svg.py index 4789dd2d6..2064734ad 100644 --- a/netbox/dcim/svg.py +++ b/netbox/dcim/svg.py @@ -482,7 +482,7 @@ class CableTraceSVG: ) parent_objects.append(parent_object) - else: + elif far_end: # Attachment attachment = self._draw_attachment()