Verify deletion actually removed the file before reporting success

MeTube's /delete only unlinks the file when it's configured with
DELETE_FILE_ON_TRASHCAN=true; otherwise it just drops the entry from its
own "done" list and returns {"status": "ok"} regardless -- we were trusting
that response and marking the job "deleted" (offering a re-download) while
the file was still sitting on mediaVM's disk the whole time.

Now HEAD-check the media_url right after the delete call. If the file is
still reachable, leave the job's status untouched (still "completed", still
playable) and surface a clear 409 explaining MeTube's own config is why,
rather than lying about local state.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-09-16 20:01:41 +00:00
parent 8ddea8762d
commit 441a3ef9df
4 changed files with 65 additions and 1 deletions

View file

@ -75,6 +75,11 @@ function DownloadButton({ video }: Props) {
>
Удалить
</button>
{deleteMutation.isError && (
<span className="download-badge error" title={(deleteMutation.error as Error).message}>
{(deleteMutation.error as Error).message}
</span>
)}
</span>
)
}