download_url: Handle possible incorrect URL by returning None - transferwee - Download/upload file via wetransfer.com (HTM) git clone https://github.com/iamleot/transferwee (DIR) Log (DIR) Files (DIR) Refs (DIR) README --- (DIR) commit c7812039c637b1722384c2866968d23f1bb52987 (DIR) parent 55d967a2ce835bed3da438d465cf4bb23a19d535 (HTM) Author: Leonardo Taccari <iamleot@gmail.com> Date: Sun, 30 Dec 2018 12:43:21 +0100 download_url: Handle possible incorrect URL by returning None Thanks to @gilbertotcc for spotting this problem! Diffstat: M transferwee.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- (DIR) diff --git a/transferwee.py b/transferwee.py @@ -78,7 +78,8 @@ def download_url(url: str) -> str: received via email by recipients when the files are shared via email upload - Return the download URL (AKA `direct_link') as a str. + Return the download URL (AKA `direct_link') as a str or None if the URL + could not be parsed. """ # Follow the redirect if we have a short URL if url.startswith('https://we.tl/'): @@ -92,6 +93,8 @@ def download_url(url: str) -> str: transfer_id, security_hash = params elif len(params) == 3: transfer_id, recipient_id, security_hash = params + else + return None j = { "security_hash": security_hash,