From 3ed2669c9d9502091737807faf6389e35236344c Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Sun, 10 Sep 2017 21:59:43 +0200 Subject: [PATCH] Fix handling of Content-Disposition headers --- handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler.py b/handler.py index 59620f4..c13e21d 100755 --- a/handler.py +++ b/handler.py @@ -59,7 +59,7 @@ def pageHandler(driver): fid = a["href"].split("=")[1] if not glob.glob("files/sbd%s*" % fid): res = session.get("https://scriptzbase.org/%s" % a["href"]) - fname = re.findall("filename=(.+)", res.headers["content-disposition"])[0].strip('"') + fname = re.findall("filename=(.+)", res.headers["content-disposition"])[0].split(";")[0].strip('"') with open("files/sbd%s_%s" % (fid, fname), "wb") as out: out.write(res.content)