Whole file

jazzband/dj-database-url

The author described this change as Fix IPv6 address parsing. It counts as a record because the check below fails on the code as it stood at 471a786b6 and passes on be4c7f226, with nothing else changed between the two runs.

Fix saved2017-01-20
Sharing licenceBSD-3-Clause · LICENSE
Change size+7 6

What the code was meant to do, written into the code itself as a save note

Fix IPv6 address parsing

The change

8787 path = ':memory:'
8888
8989 # Handle postgres percent-encoded paths.
90- netloc = url.netloc
91- if "@" in netloc:
92- netloc = netloc.rsplit("@", 1)[1]
93- if ":" in netloc:
94- netloc = netloc.split(":", 1)[0]
95- hostname = netloc or ''
90+ hostname = url.hostname or ''
9691 if '%2f' in hostname.lower():
92+ # Switch to url.netloc to avoid lower cased paths
93+ hostname = url.netloc
94+ if "@" in hostname:
95+ hostname = hostname.rsplit("@", 1)[1]
96+ if ":" in hostname:
97+ hostname = hostname.split(":", 1)[0]
9798 hostname = hostname.replace('%2f', '/').replace('%2F', '/')
9899
99100 # Update with environment configuration.

The check that tells the two apart

failpass·test_dj_database_url.py::DatabaseTestSuite::test_ipv6_parsing

Check file test_dj_database_url.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it471a786b64ab034a2ea2b624bc599dae64d6ae49
Broken version dated2017-01-05
Moduledj_database_url
Units changedparse
Fingerprintc2800c18ad27c2db
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.