Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] 500 error by enforcing valid UUID patterns in admin URLs #682 #978

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Unnati-Gupta24
Copy link

@Unnati-Gupta24 Unnati-Gupta24 commented Feb 12, 2025

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #682 .

Description of Changes

This PR fixes a 500 Internal Server Error caused by an incorrect NoReverseMatch when certain admin URLs are accessed. The issue happened because the URL pattern was too loose, allowing invalid UUID formats.

What’s changed?

  • Updated the regex to allow only valid UUIDs.
  • Added a check in admin.py to ensure UUIDs follow the correct format.
  • Updated url.py accordingly.
  • Kept support for both standard UUIDs (4290a79a-e740-4abf-b49e-9d5789b580f6) and hex format (4290a79ae7404abfb49e9d5789b580f6).
  • Maintained backward compatibility by keeping re_path where needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] 500 internal server error for NoReverse match
1 participant