From 67bdfe24c499153b9a121d5c39e10caf0fc67f3c Mon Sep 17 00:00:00 2001 From: Noah Saso Date: Mon, 26 Oct 2020 15:38:13 -0700 Subject: [PATCH] Clean up encoded query params from file extension --- loconotion/notionparser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loconotion/notionparser.py b/loconotion/notionparser.py index 1e35d28..887c79d 100644 --- a/loconotion/notionparser.py +++ b/loconotion/notionparser.py @@ -183,6 +183,8 @@ class Parser: content_type = response.headers.get("content-type") if content_type: file_extension = mimetypes.guess_extension(content_type) + elif '%3f' in file_extension.lower(): + file_extension = re.split("%3f", file_extension, flags=re.IGNORECASE)[0] destination = destination.with_suffix(file_extension) Path(destination).parent.mkdir(parents=True, exist_ok=True)