[PR #18244] [MERGED] Fixes: #17868 - Handle orphaned cable condition gracefully in SVG rendering #15300

Closed
opened 2025-12-30 00:21:08 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18244
Author: @bctiemann
Created: 12/17/2024
Status: Merged
Merged: 12/17/2024
Merged by: @jeremystretch

Base: developHead: 17868-fix-divide-by-zero-on-cable-trace


📝 Commits (4)

  • 2c2815e Handle condition gracefully where an empty object list is passed in to draw_far_objects (e.g. orphaned cable where attached device has been deleted)
  • 25b5d70 Move continue statement to right after draw_far_objects
  • e22d03a Preferable falsy syntax
  • 129532b Check far_ends rather than altering draw_far_objects

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 netbox/dcim/svg/cables.py (+1 -1)

📄 Description

Fixes: #17868

If a device has been deleted, attached cables may be left orphaned, which leads to rendering errors when generating the cable trace SVG. This fix handles the case where the object list passed in to draw_far_objects is empty by returning empty lists of results and then handling those gracefully so that the remaining portion of the SVG can be rendered.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/18244 **Author:** [@bctiemann](https://github.com/bctiemann) **Created:** 12/17/2024 **Status:** ✅ Merged **Merged:** 12/17/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `17868-fix-divide-by-zero-on-cable-trace` --- ### 📝 Commits (4) - [`2c2815e`](https://github.com/netbox-community/netbox/commit/2c2815e5b8c7d94c39f9183deff9d70a8b47c370) Handle condition gracefully where an empty object list is passed in to draw_far_objects (e.g. orphaned cable where attached device has been deleted) - [`25b5d70`](https://github.com/netbox-community/netbox/commit/25b5d70b6dcbfbf33a42565dbb31905049d9cd90) Move continue statement to right after draw_far_objects - [`e22d03a`](https://github.com/netbox-community/netbox/commit/e22d03a7d4069cd018b19ea233a9c88af091560f) Preferable falsy syntax - [`129532b`](https://github.com/netbox-community/netbox/commit/129532b5473e7ca1b2d67b23f875cfbb41ab2f66) Check far_ends rather than altering draw_far_objects ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/svg/cables.py` (+1 -1) </details> ### 📄 Description ### Fixes: #17868 If a device has been deleted, attached cables may be left orphaned, which leads to rendering errors when generating the cable trace SVG. This fix handles the case where the object list passed in to `draw_far_objects` is empty by returning empty lists of results and then handling those gracefully so that the remaining portion of the SVG can be rendered. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:21:08 +01:00
adam closed this issue 2025-12-30 00:21:08 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15300