You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my code I often have site URLs like foo/bar/baz/ instead of https://example.com/foo/bar/baz because they work equally well regardless of where the site is running. However, the logic in NavItem.get_active does compare the scheme and netloc of the request and the URL of the navigation item. If the latter is empty the condition will fail because the request does carry that information.
if (
parsed_url.scheme!=parsed_request.schemeorparsed_url.netloc!=parsed_request.netloc
):
returnFalse
I propose adjusting the condition skip the equality check if the URL lacks that information:
if (
parsed_url.schemeandparsed_url.scheme!=parsed_request.schemeorparsed_url.netlocandparsed_url.netloc!=parsed_request.netloc
):
returnFalse
What is your opinion?
The text was updated successfully, but these errors were encountered:
HiPhish
added a commit
to HiPhish/django-simple-nav
that referenced
this issue
Apr 15, 2025
In my code I often have site URLs like
foo/bar/baz/
instead ofhttps://example.com/foo/bar/baz
because they work equally well regardless of where the site is running. However, the logic inNavItem.get_active
does compare thescheme
andnetloc
of the request and the URL of the navigation item. If the latter is empty the condition will fail because the request does carry that information.I propose adjusting the condition skip the equality check if the URL lacks that information:
What is your opinion?
The text was updated successfully, but these errors were encountered: