complete performance and reliability follow-ups

This commit is contained in:
2026-08-09 23:04:36 +05:30
parent 8f19a5eb2b
commit 232d8e6734
31 changed files with 525 additions and 726 deletions
+2 -1
View File
@@ -170,7 +170,8 @@ export const UPLOAD_RUNTIME = `
});
xhr.addEventListener("load", function () {
var data = null;
try { data = JSON.parse(xhr.responseText); } catch (e2) {}
try { data = JSON.parse(xhr.responseText); }
catch (error) { console.warn("[wrnexus:uploader] upload response was not valid JSON", error); }
if (xhr.status >= 200 && xhr.status < 300 && data && data.ok) {
done(ui, (data.files && data.files[0]) || null, file);
} else {
+6
View File
@@ -11,6 +11,12 @@ import {
upload,
verifySignedFileToken,
} from "../src/index.ts";
import { UPLOAD_RUNTIME } from "../src/runtime.ts";
test("browser upload response parse failures emit a diagnostic", () => {
expect(UPLOAD_RUNTIME).toContain("upload response was not valid JSON");
expect(UPLOAD_RUNTIME).not.toContain("catch (e2) {}");
});
function configure() {
configureStorage(