fix(web): server-side DELETE for failed/discarded uploads (no janitor wait)

This commit is contained in:
Jannis Braun
2026-05-02 18:22:45 +02:00
parent dd91f5f349
commit 4e5a440176
3 changed files with 35 additions and 11 deletions
+8 -3
View File
@@ -542,11 +542,16 @@ export function Message({ message, isCompact, isFirstInGroup, previousMessageId
const transfers = useTransferStore.getState().transfers;
for (const tid of pending.transferIds) {
const t = transfers.get(tid);
if (t && (t.state === 'active' || t.state === 'paused' || t.state === 'queued')) {
if (!t) continue;
// Route anything with potential server-side state (active/paused/
// queued/failed) through abortUpload — it sends DELETE so the
// .tus session doesn't sit on disk for the janitor to sweep.
// 'aborted' already cleaned itself; 'completed' has a finalized
// attachment row that the unlinked-attachment janitor handles (1h grace).
if (t.state !== 'aborted' && t.state !== 'completed') {
useTransferStore.getState().abortUpload(tid);
} else {
useTransferStore.getState().remove(tid);
}
useTransferStore.getState().remove(tid);
}
if (channelKey) {
usePendingMessageStore.getState().removeByClientId(channelKey, pending.clientId);