From 81d5d00850b5a1096421e9001da20fa564f0156f Mon Sep 17 00:00:00 2001 From: Daniel Bornkessel Date: Wed, 2 Jan 2013 00:49:54 +0100 Subject: Remove '/' from filename to avoid filepath exception When a http url has a filename set to something that contains a '/', pyload will error out when trying to merge the chunks as it sees the '/' as part of the path. Example: HTTP Header contains: filename=55/filename.img Chunks are saved as: /55filename.img.chunk0 /55filename.img.chunk1 Exception on merge will complain: Error: file does not exist: /55/ as it thinks '55/' is a subdir --- module/network/HTTPChunk.py | 4 ++-- module/plugins/hoster/BasePlugin.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'module') diff --git a/module/network/HTTPChunk.py b/module/network/HTTPChunk.py index d17177ee7..84a2acc5f 100644 --- a/module/network/HTTPChunk.py +++ b/module/network/HTTPChunk.py @@ -263,7 +263,7 @@ class HTTPChunk(HTTPRequest): m = search("filename(?P=|\*=(?P.+)'')(?P.*)", line) if m: - name = remove_chars(m.groupdict()['name'], "\"';").strip() + name = remove_chars(m.groupdict()['name'], "\"';/").strip() self.p._name = name self.log.debug("Content-Disposition: %s" % name) @@ -295,4 +295,4 @@ class HTTPChunk(HTTPRequest): """ closes everything, unusable after this """ if self.fp: self.fp.close() self.c.close() - if hasattr(self, "p"): del self.p \ No newline at end of file + if hasattr(self, "p"): del self.p diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 1ac33931f..b495be873 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -86,7 +86,7 @@ class BasePlugin(Hoster): disp = m.groupdict() self.logDebug(disp) if not disp['enc']: disp['enc'] = 'utf-8' - name = remove_chars(disp['name'], "\"';").strip() + name = remove_chars(disp['name'], "\"';/").strip() name = unicode(unquote(name), disp['enc']) if not name: name = url -- cgit v1.2.3