Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit a14484f

Browse files
committed
add protocol to sanitize urls
1 parent e4aa645 commit a14484f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

common/Config.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,15 @@ def build_configuration() -> Config:
5353
return config
5454

5555

56-
def sanitize_url(url: str, protocol: str = 'https//') -> str:
56+
def sanitize_url(url: str, protocol: str = 'https://') -> str:
5757
"""
5858
Takes URL, removes last / and prepends protocol.
59+
60+
>>> sanitize_url('charon.com/something/')
61+
'https://charon.com/something'
5962
"""
6063
sanitized = url[0:-1] if url[-1] == '/' else url
61-
with_protocol = sanitized if sanitized.startswith('http') else f'{protocol}{url}'
64+
with_protocol = sanitized if sanitized.startswith('http') else f'{protocol}{sanitized}'
6265
return with_protocol
6366

6467

0 commit comments

Comments
 (0)