From f4154bd6ee52a039dc2880e56bc15ba8dfdc0848 Mon Sep 17 00:00:00 2001 From: Tobias Goerke Date: Thu, 27 Jul 2023 09:01:07 +0200 Subject: [PATCH] fix: remove stale storage keys from localStorage --- frontend/src/api/tus.js | 4 ++++ http/tus_store.go | 1 + 2 files changed, 5 insertions(+) diff --git a/frontend/src/api/tus.js b/frontend/src/api/tus.js index cd4456b9..0e4e67a7 100644 --- a/frontend/src/api/tus.js +++ b/frontend/src/api/tus.js @@ -43,6 +43,10 @@ export async function upload(url, content = "", overwrite = false, onupload) { } }, onSuccess: function () { + // Remove the upload from the storage when completed. + // Otherwise, old storage keys aren't overwritten, which + // lets resumable uploads fail. + upload._removeFromUrlStorage(); resolve(); }, }); diff --git a/http/tus_store.go b/http/tus_store.go index 90ba7b61..241e4534 100644 --- a/http/tus_store.go +++ b/http/tus_store.go @@ -16,6 +16,7 @@ import ( "crypto/rand" "encoding/hex" "errors" + "fmt" "io" "net/http" "os"