summaryrefslogtreecommitdiffstats
path: root/module/network
diff options
context:
space:
mode:
authorGravatar spoob <spoob@gmx.de> 2009-09-03 16:44:21 +0200
committerGravatar spoob <spoob@gmx.de> 2009-09-03 16:44:21 +0200
commitaaa0dfd0a5a8843b549e6c1ea66fcb786a8069cf (patch)
tree89cfe1f1509e116d368578f73797b13608ab878d /module/network
parentnetload fix (diff)
downloadpyload-aaa0dfd0a5a8843b549e6c1ea66fcb786a8069cf.tar.xz
Fixed #24
Diffstat (limited to 'module/network')
-rwxr-xr-xmodule/network/Request.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/module/network/Request.py b/module/network/Request.py
index e693afa1d..084c84f95 100755
--- a/module/network/Request.py
+++ b/module/network/Request.py
@@ -9,10 +9,11 @@ import base64
import cookielib
from gzip import GzipFile
import time
+import re
from os import sep, rename
from os.path import dirname, exists
import urllib
-
+from base64 import b64decode
from cStringIO import StringIO
try:
@@ -240,11 +241,25 @@ class Request:
self.dl = True
self.pycurl.perform()
+ if "..." in file_name:
+ download_folder = dirname(file_name) + sep
+ headers = self.get_header()
+ file_name_search = re.search('filename=(?P<quote>\")?(.+)(?(quote)\")', headers)
+ if file_name_search:
+ file_name = file_name_search.group(2)
+ if "?=" in file_name[-3:]:
+ file_name = file_name.replace("=?UTF-8?B?", "").replace("?=", "==")
+ file_name = b64decode(file_name)
+ file_name = download_folder + sep + file_name
+
file_count = 0
while exists(file_name):
file_count += 1
- file_split = file_name.split(".")
- temp_name = "%s-%i.%s" % (file_split[0], file_count, file_split[1])
+ if "." in file_name:
+ file_split = file_name.split(".")
+ temp_name = "%s-%i.%s" % (".".join(file_split[:-1]), file_count, file_split[-1])
+ else:
+ temp_name = "%s-%i" % (file_name, file_count)
if not exists(temp_name):
file_name = temp_name