Fixed legacy mode download when file exists
parent
c9de9244f4
commit
2c7b35033b
|
@ -1164,20 +1164,20 @@ class Browser:
|
||||||
else:
|
else:
|
||||||
file_name = request_receipt.response[0]
|
file_name = request_receipt.response[0]
|
||||||
file_data = request_receipt.response[1]
|
file_data = request_receipt.response[1]
|
||||||
file_destination_name = file_name.split("/")
|
file_destination_name = os.path.basename(file_name)
|
||||||
file_destination_name = file_destination_name[len(file_destination_name)-1]
|
|
||||||
file_destination = self.app.downloads_path+"/"+file_destination_name
|
file_destination = self.app.downloads_path+"/"+file_destination_name
|
||||||
|
|
||||||
counter = 0
|
counter = 0
|
||||||
while os.path.isfile(file_destination):
|
while os.path.isfile(file_destination):
|
||||||
counter += 1
|
counter += 1
|
||||||
file_destination = self.app.downloads_path+"/"+file_name+"."+str(counter)
|
file_destination = self.app.downloads_path+"/"+file_destination_name+"."+str(counter)
|
||||||
|
|
||||||
fh = open(file_destination, "wb")
|
fh = open(file_destination, "wb")
|
||||||
fh.write(file_data)
|
fh.write(file_data)
|
||||||
fh.close()
|
fh.close()
|
||||||
|
|
||||||
self.saved_file_name = file_destination.replace(self.app.downloads_path+"/", "", 1)
|
self.saved_file_name = file_destination.replace(self.app.downloads_path+"/", "", 1)
|
||||||
|
|
||||||
self.status = Browser.DONE
|
self.status = Browser.DONE
|
||||||
self.response_progress = 0
|
self.response_progress = 0
|
||||||
self.response_speed = None
|
self.response_speed = None
|
||||||
|
|
Loading…
Reference in New Issue