downloads: don't crash on OSError in open-download
Fixes the crash in #1725, but does not provide a solution. The browser won't crash, but the file won't be downloaded and opened either.
This commit is contained in:
parent
ef439bb916
commit
9973cd5037
@ -947,7 +947,13 @@ class DownloadManager(QAbstractListModel):
|
|||||||
download.set_filename(target.filename)
|
download.set_filename(target.filename)
|
||||||
elif isinstance(target, usertypes.OpenFileDownloadTarget):
|
elif isinstance(target, usertypes.OpenFileDownloadTarget):
|
||||||
tmp_manager = objreg.get('temporary-downloads')
|
tmp_manager = objreg.get('temporary-downloads')
|
||||||
fobj = tmp_manager.get_tmpfile(suggested_filename)
|
try:
|
||||||
|
fobj = tmp_manager.get_tmpfile(suggested_filename)
|
||||||
|
except OSError as exc:
|
||||||
|
msg = "Download error: {}".format(exc)
|
||||||
|
message.error(self._win_id, msg)
|
||||||
|
download.cancel()
|
||||||
|
return
|
||||||
download.finished.connect(download.open_file)
|
download.finished.connect(download.open_file)
|
||||||
download.autoclose = True
|
download.autoclose = True
|
||||||
download.set_fileobj(fobj)
|
download.set_fileobj(fobj)
|
||||||
|
Loading…
Reference in New Issue
Block a user