Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasAlbertQC committed May 31, 2023
1 parent b02a53f commit 56ebe0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion quetz/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def sanitize_db_url(db_url: str) -> str:
# Attempt 1: Actual parsing, this is ideal but may fail
try:
parsed_url = make_url(db_url)
return db_url.replace(parsed_url.password, "***")
if parsed_url.password:
return db_url.replace(parsed_url.password, "***")
except ArgumentError:
pass

Expand Down
1 change: 1 addition & 0 deletions quetz/tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"postgresql+psycopg2://postgres_user:***@localhost:5432/postgres",
),
("A:B@C:1111/DB", "A:***@C:1111/DB"),
("THISISNOTAURL", "THISISNOTAURL"),
),
)
def test_sanitize_db_url(input_url, expected_output_url):
Expand Down

0 comments on commit 56ebe0b

Please sign in to comment.