Helpviewer/Download/DownloadItem.py

changeset 4326
e52318f11812
parent 4318
c2f374ca452b
child 4443
f7f61a66dc38
equal deleted inserted replaced
4325:3e6dd786a5ff 4326:e52318f11812
268 Private method to calculate a name for the file to download. 268 Private method to calculate a name for the file to download.
269 269
270 @param directory name of the directory to store the file into (string) 270 @param directory name of the directory to store the file into (string)
271 @return proposed filename and original filename (string, string) 271 @return proposed filename and original filename (string, string)
272 """ 272 """
273 ## path = ""
274 ## if self.__reply.hasRawHeader("Content-Disposition"):
275 ## header = bytes(self.__reply.rawHeader("Content-Disposition"))\
276 ## .decode()
277 ## if header:
278 ## pos = header.find("filename=")
279 ## if pos != -1:
280 ## path = header[pos + 9:]
281 ## if path.startswith('"') and path.endswith('"'):
282 ## path = path[1:-1]
283 ## if not path:
284 ## path = self.__url.path()
285 ##
286 path = parseContentDisposition(self.__reply) 273 path = parseContentDisposition(self.__reply)
287 info = QFileInfo(path) 274 info = QFileInfo(path)
288 baseName = info.completeBaseName() 275 baseName = info.completeBaseName()
289 endName = info.suffix() 276 endName = info.suffix()
290 277
291 ## if not baseName:
292 ## baseName = "unnamed_download"
293 ##
294 origName = baseName 278 origName = baseName
295 if endName: 279 if endName:
296 origName += '.' + endName 280 origName += '.' + endName
297 281
298 name = directory + baseName 282 name = directory + baseName

eric ide

mercurial