mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 14:08:03 -06:00
WebUI: Display error when download fails
Previously we would still download the file but it would contain the error response, resulting in an invalid file. To test: export a .torrent file for a torrent that hasn't yet downloaded metadata PR #21696. Signed-off-by: Thomas Piccirello <thomas@piccirello.com>
This commit is contained in:
committed by
GitHub
parent
61ff683f11
commit
78a5e4ff3e
@@ -1115,16 +1115,10 @@ const initializeWindows = () => {
|
||||
continue;
|
||||
|
||||
const name = row.full_data.name;
|
||||
const url = new URI("api/v2/torrents/export");
|
||||
url.setData("hash", hash);
|
||||
const url = new URI("api/v2/torrents/export").setData("hash", hash).toString();
|
||||
|
||||
// download response to file
|
||||
const element = document.createElement("a");
|
||||
element.href = url;
|
||||
element.download = (name + ".torrent");
|
||||
document.body.appendChild(element);
|
||||
element.click();
|
||||
document.body.removeChild(element);
|
||||
await window.qBittorrent.Misc.downloadFile(url, `${name}.torrent`, "QBT_TR(Unable to export torrent file)QBT_TR[CONTEXT=MainWindow]");
|
||||
|
||||
// https://stackoverflow.com/questions/53560991/automatic-file-downloads-limited-to-10-files-on-chrome-browser
|
||||
await window.qBittorrent.Misc.sleep(200);
|
||||
|
||||
Reference in New Issue
Block a user