| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
RFC 3986 Section 6.2.2.2 requires percent-encodings of unreserved characters to be decoded. normalize_percent_characters() only upper-cased them, so normalized_equality() returned False for URIs the RFC treats as equivalent. Reserved and non-ASCII octets stay encoded.
| Back | FazBrowse Home | New Git URL |
normalize_percent_characters() only upper-cases percent-triples; RFC 3986 §6.2.2.2 also requires decoding triples of unreserved characters (ALPHA / DIGIT / "-" / "." / "_" / "~"). Because the decode step is missing, the library's own equality predicate returns the wrong answer for URIs the RFC treats as equivalent:
uri_reference("http://example.com/%7Efoo").normalized_equality( uri_reference("http://example.com/~foo")) # False, RFC says equivalentThe fix decodes unreserved triples after the existing upper-case pass. Reserved octets (%2F, %21, …) and non-ASCII octets (%DF) stay encoded. One visible consequence: %2E in paths now decodes before dot-segment removal, so /a/%2E%2E/b normalizes to /b per the RFC's ordering.
The module's UNRESERVED_CHARS constant also includes ! (a sub-delimiter), so the decode set is defined directly from RFC 3986 §2.3.
Tests enumerate all 256 octets across userinfo, path, query, and fragment, plus idempotence and normalized_equality.