streamed download fix

frdel committed Aug 4, 2025 at 21:35 UTC d5d0755e5a90fdeafb83408fb0c0d24e603b7bc0
1 file changed +8 -26
webui/js/file_browser.js
+8 -26
@@ -193,33 +193,15 @@ const fileBrowserModalProxy = {
193 }
194 },
195
196 - async downloadFile(file) {
197 - try {
198 - const downloadUrl = `/download_work_dir_file?path=${encodeURIComponent(
199 - file.path
200 - )}`;
201 -
202 - const response = await fetchApi(downloadUrl);
203 -
204 - if (!response.ok) {
205 - throw new Error("Network response was not ok");
206 - }
207 -
208 - const blob = await response.blob();
209 -
210 - const link = document.createElement("a");
211 - link.href = window.URL.createObjectURL(blob);
212 - link.download = file.name;
213 - document.body.appendChild(link);
214 - link.click();
215 - document.body.removeChild(link);
216 - window.URL.revokeObjectURL(link.href);
217 - } catch (error) {
218 - window.toastFrontendError("Error downloading file: " + error.message, "File Download Error");
219 - alert("Error downloading file");
220 - }
196 + downloadFile(file) {
197 + const link = document.createElement("a");
198 + link.href = `/download_work_dir_file?path=${encodeURIComponent(file.path)}`;
199 + link.download = file.name;
200 + document.body.appendChild(link);
201 + link.click();
202 + document.body.removeChild(link);
203 },
222 -
204 +
205 // Helper Functions
206 formatFileSize(size) {
207 if (size === 0) return "0 Bytes";