Helpviewer/Download/DownloadItem.py

changeset 4318
c2f374ca452b
parent 4021
195a471c327b
child 4326
e52318f11812
diff -r 0de465a93200 -r c2f374ca452b Helpviewer/Download/DownloadItem.py
--- a/Helpviewer/Download/DownloadItem.py	Sat Jul 18 15:14:28 2015 +0200
+++ b/Helpviewer/Download/DownloadItem.py	Sat Jul 18 16:50:24 2015 +0200
@@ -24,6 +24,7 @@
 from .Ui_DownloadItem import Ui_DownloadItem
 
 from .DownloadUtilities import timeString, dataString
+from ..HelpUtilities import parseContentDisposition
 
 import UI.PixmapCache
 import Preferences
@@ -269,26 +270,27 @@
         @param directory name of the directory to store the file into (string)
         @return proposed filename and original filename (string, string)
         """
-        path = ""
-        if self.__reply.hasRawHeader("Content-Disposition"):
-            header = bytes(self.__reply.rawHeader("Content-Disposition"))\
-                .decode()
-            if header:
-                pos = header.find("filename=")
-                if pos != -1:
-                    path = header[pos + 9:]
-                    if path.startswith('"') and path.endswith('"'):
-                        path = path[1:-1]
-        if not path:
-            path = self.__url.path()
-        
+##        path = ""
+##        if self.__reply.hasRawHeader("Content-Disposition"):
+##            header = bytes(self.__reply.rawHeader("Content-Disposition"))\
+##                .decode()
+##            if header:
+##                pos = header.find("filename=")
+##                if pos != -1:
+##                    path = header[pos + 9:]
+##                    if path.startswith('"') and path.endswith('"'):
+##                        path = path[1:-1]
+##        if not path:
+##            path = self.__url.path()
+##        
+        path = parseContentDisposition(self.__reply)
         info = QFileInfo(path)
         baseName = info.completeBaseName()
         endName = info.suffix()
         
-        if not baseName:
-            baseName = "unnamed_download"
-        
+##        if not baseName:
+##            baseName = "unnamed_download"
+##        
         origName = baseName
         if endName:
             origName += '.' + endName

eric ide

mercurial