refactor(media): use asset-centric storage key layout

This commit is contained in:
2026-02-12 18:41:01 +01:00
parent 86a8af25d8
commit 3e4f0b6c75
12 changed files with 218 additions and 27 deletions

View File

@@ -44,10 +44,15 @@ export function MediaUploadForm() {
const payload = (await response.json().catch(() => null)) as {
notice?: string
provider?: "s3" | "local"
warning?: string
} | null
const notice = payload?.notice ?? "Media uploaded."
window.location.href = `/media?notice=${encodeURIComponent(notice)}`
const provider = payload?.provider ?? "local"
const warning = payload?.warning
const warningQuery = warning ? `&warning=${encodeURIComponent(warning)}` : ""
window.location.href = `/media?notice=${encodeURIComponent(notice)}&uploadedVia=${encodeURIComponent(provider)}${warningQuery}`
} catch {
setError("Upload request failed. Please retry.")
} finally {
@@ -68,8 +73,7 @@ export function MediaUploadForm() {
<span className="text-xs text-neutral-600">Title</span>
<input
name="title"
required
minLength={1}
placeholder="Optional (defaults to file name)"
className="w-full rounded border border-neutral-300 px-3 py-2 text-sm"
/>
</label>