remove any double quotes from filename obtained from content-disposition header, if any
This commit is contained in:
1 parent
ea58e48dad
commit
65d5d8963b
1 file changed
+1
@@ -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]
|
||||
|
||||
|
||||
Reference in new issue
Block a user