Skip to content

Commit 69116b6

Browse files
committed
Fix repr() for file:// URLs
1 parent 1aefd9b commit 69116b6

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

ada_url/ada_adapter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ def __str__(self):
273273

274274
def __repr__(self):
275275
duplicate = deepcopy(self)
276-
duplicate.password = ''
276+
if duplicate.password:
277+
duplicate.password = ''
277278
return f'<URL "{duplicate.href}">'
278279

279280
@staticmethod

tests/test_ada_url.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ def test_to_repr_password(self):
203203
str(urlobj), 'https://user:password1@example.org/something.txt'
204204
)
205205

206+
def test_repr_file(self):
207+
url = URL('file:///')
208+
repr(url)
209+
206210
def test_check_url(self):
207211
for s, expected in (
208212
('https:example.org', True),

0 commit comments

Comments
 (0)