Exception when a script name is equal to the start of the name of another one #14025
Labels
severity: medium
Results in substantial degraded or broken functionality for specfic workflows
status: accepted
This issue has been accepted for implementation
type: bug
A confirmed report of unexpected behavior in the application
NetBox version
v3.6.2
Python version
3.11
Steps to Reproduce
test.py
andtestscript.py
Expected Behavior
The script page should be opened
Observed Behavior
Error in website
and
Error in logging:
2023-10-12 13:26:02,131 django.request ERROR: Internal Server Error: /extras/scripts/test/Test/ Traceback (most recent call last): File "/opt/netbox/dev/venv/lib64/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/dev/venv/lib64/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/dev/venv/lib64/python3.11/site-packages/django/views/generic/base.py", line 104, in view return self.dispatch(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/dev/netbox/utilities/views.py", line 53, in dispatch return super().dispatch(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/dev/venv/lib64/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch return handler(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/dev/netbox/extras/views.py", line 1160, in get module = get_object_or_404(ScriptModule.objects.restrict(request.user), file_path__startswith=module) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/dev/venv/lib64/python3.11/site-packages/django/shortcuts.py", line 85, in get_object_or_404 return queryset.get(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/dev/venv/lib64/python3.11/site-packages/django/db/models/query.py", line 640, in get raise self.model.MultipleObjectsReturned( extras.models.scripts.ScriptModule.MultipleObjectsReturned: get() returned more than one ScriptModule -- it returned 2!
The text was updated successfully, but these errors were encountered: