[PR #14030] [MERGED] 14025 fix script name checking #14299

Closed
opened 2025-12-29 23:23:40 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/14030
Author: @arthanson
Created: 10/12/2023
Status: Merged
Merged: 10/17/2023
Merged by: @jeremystretch

Base: developHead: 14025-script-name


📝 Commits (7)

  • 3538508 14025 fix script name checking
  • d337283 14025 fix script name checking
  • de30f55 14025 add file extension validation and simplify get logic
  • b011c2c 14025 match start of string with regex
  • 1c942d0 Merge branch 'develop' into 14025-script-name
  • 0d24508 14025 backout changes to model_forms
  • 48450a2 14025 add filepatch checking to reports

📊 Changes

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

View changed files

📝 netbox/extras/views.py (+16 -8)

📄 Description

Fixes: #14025

@jeremystretch the module name checking is a bit verbose, not sure if there is a simpler way to do this.

The issue is if you have the script "test.py" module comes in as "test" and file_path is "test.py" which is why the startswith is there. If you remove startswith it won't match. I think it would be difficult at this point to change module to keep the full name with .py as I think it is stored that way.

Ideally if we could remove a potential ".py" from file_path in the filter clause but I don't think there is a way to do that. it would also work to change how the scripts are stored to include the full name but that would require a data migration with potentially incomplete historical information.


🔄 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/14030 **Author:** [@arthanson](https://github.com/arthanson) **Created:** 10/12/2023 **Status:** ✅ Merged **Merged:** 10/17/2023 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `14025-script-name` --- ### 📝 Commits (7) - [`3538508`](https://github.com/netbox-community/netbox/commit/3538508639a276c997caef2e8269870e48a73ebd) 14025 fix script name checking - [`d337283`](https://github.com/netbox-community/netbox/commit/d3372830955d7d94df8598559863b89feabb2e1a) 14025 fix script name checking - [`de30f55`](https://github.com/netbox-community/netbox/commit/de30f551348c08ba333a53c0101ccf20ff661d10) 14025 add file extension validation and simplify get logic - [`b011c2c`](https://github.com/netbox-community/netbox/commit/b011c2c7c660282e38c005eca83b7cb3fdd9970d) 14025 match start of string with regex - [`1c942d0`](https://github.com/netbox-community/netbox/commit/1c942d0538aa9d3b12c3d998c27f38e51dcc413a) Merge branch 'develop' into 14025-script-name - [`0d24508`](https://github.com/netbox-community/netbox/commit/0d2450868b509d9674bee6f38376a78d2975a0f9) 14025 backout changes to model_forms - [`48450a2`](https://github.com/netbox-community/netbox/commit/48450a24745aeccfa7f07aad074c76ba8e99b0e5) 14025 add filepatch checking to reports ### 📊 Changes **1 file changed** (+16 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/views.py` (+16 -8) </details> ### 📄 Description ### Fixes: #14025 @jeremystretch the module name checking is a bit verbose, not sure if there is a simpler way to do this. The issue is if you have the script "test.py" module comes in as "test" and file_path is "test.py" which is why the startswith is there. If you remove startswith it won't match. I think it would be difficult at this point to change module to keep the full name with .py as I think it is stored that way. Ideally if we could remove a potential ".py" from file_path in the filter clause but I don't think there is a way to do that. it would also work to change how the scripts are stored to include the full name but that would require a data migration with potentially incomplete historical information. --- <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-29 23:23:40 +01:00
adam closed this issue 2025-12-29 23:23:40 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#14299