fix(upload): surface thumbnail/.torrent upload failures to the user

These optional-asset uploads are non-fatal, but failures were warn-only — the
user got a silently-missing thumbnail or torrent with no signal. Both upload
services now emit a 'warning' status at the point of failure and append a note
to the final 'Published' status (downgraded to warning variant) listing what
failed. Cloudflare-upload audit #5.

Test: tests/services/s3-upload-optional-asset-failures.test.mjs.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
thePR0M3TH3ANandClaude Opus 4.8 committed 2026-06-16 20:19:27 -04:00
1 parent 04ae0ec4e6
commit 3d6ffe997b
3 files changed
+156 -3

No files matched your search

+25 -1
View File
@@ -321,6 +321,11 @@ export class S3UploadService {
let statusMessage = `Uploading to ${normalized.bucket}…`;
this.setUploadStatus(statusMessage, "info");
// Track optional-asset failures so the user gets a visible signal instead
// of a silently-missing thumbnail/torrent (Cloudflare-upload #5).
let thumbnailFailed = false;
let torrentFailed = false;
if (thumbnailFile) {
this.setUploadStatus("Uploading thumbnail...", "info");
const thumbExt = thumbnailFile.name.split(".").pop() || "jpg";
@@ -350,6 +355,11 @@ export class S3UploadService {
"Thumbnail upload failed, continuing with video...",
err
);
thumbnailFailed = true;
this.setUploadStatus(
"Thumbnail upload failed — publishing without it.",
"warning"
);
}
}
@@ -404,6 +414,11 @@ export class S3UploadService {
"Torrent metadata upload failed, continuing...",
err
);
torrentFailed = true;
this.setUploadStatus(
"Torrent upload failed — publishing URL-first without the .torrent.",
"warning"
);
}
}
@@ -481,7 +496,16 @@ export class S3UploadService {
});
if (published) {
this.setUploadStatus(`Published ${publicUrl}`, "success");
const caveats = [];
if (thumbnailFailed) caveats.push("thumbnail");
if (torrentFailed) caveats.push("torrent");
const suffix = caveats.length
? ` (note: ${caveats.join(" & ")} upload failed)`
: "";
this.setUploadStatus(
`Published ${publicUrl}${suffix}`,
caveats.length ? "warning" : "success"
);
}
return Boolean(published);
} catch (err) {