From 7a4dfbcee41395e10c622aae0d015f550978df30 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Wed, 29 Apr 2015 23:31:10 +0300 Subject: fix 'Content-Disposition' filename cutting first and last chars --- module/plugins/internal/SimpleHoster.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index d65d12403..f32d7c036 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -245,7 +245,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.38" + __version__ = "1.39" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -501,7 +501,7 @@ class SimpleHoster(Hoster): try: if disposition: content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') - self.pyfile.name = (content[1].split('filename=')[1][1:-1] + self.pyfile.name = (content[1].split('filename=')[1].strip('"') or urlparse.urlparse(urllib.unquote(url)).path.split('/')[-1] or self.pyfile.name) finally: -- cgit v1.2.3 From 831e1cd10f97b890d980ba0b5708284bb23b0f64 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Wed, 29 Apr 2015 23:48:34 +0300 Subject: Update SimpleHoster.py --- module/plugins/internal/SimpleHoster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index f32d7c036..0bc529cbe 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -501,7 +501,7 @@ class SimpleHoster(Hoster): try: if disposition: content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') - self.pyfile.name = (content[1].split('filename=')[1].strip('"') + self.pyfile.name = (content[1].split('filename=')[1].strip('"\'') or urlparse.urlparse(urllib.unquote(url)).path.split('/')[-1] or self.pyfile.name) finally: -- cgit v1.2.3