remove any double quotes from filename obtained from content-disposition header, if any

This commit is contained in:
Khoi authored and Gina Häußge committed 2020-08-06 12:19:41 +02:00
1 parent ea58e48dad
commit 65d5d8963b
1 file changed
+1
+1
View File
@@ -203,6 +203,7 @@ def download_file(url, folder, max_length=None):
r.raise_for_status()
if "Content-Disposition" in r.headers.keys():
filename = re.findall("filename=(.+)", r.headers["Content-Disposition"])[0]
filename = filename.replace('"', '') # remove any double quotes in the file name
else:
filename = url.split("/")[-1]