From f3306dd5333cedfbe0a713b8dc31f9b80ffbf044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Fri, 17 Jul 2026 19:24:40 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20notes=20file=20upload=20e?= =?UTF-8?q?rror=20handling=20and=20preview=20resilience=20-=20blobClient?= =?UTF-8?q?=20parses=20JSON=20error=20body=20instead=20of=20bare=20status?= =?UTF-8?q?=20text=20-=20NoteFilePreview=20shows=20fetch=20errors=20inline?= =?UTF-8?q?=20instead=20of=20hanging=20-=20NoteFilesPanel=20removed=20404/?= =?UTF-8?q?501=20catch-all=20=E2=80=94=20backend=20file=20API=20live=20-?= =?UTF-8?q?=20NotesPage=20reports=20partial=20file=20upload=20failures=20o?= =?UTF-8?q?n=20create=20-=20Added=20fileUploadPartial=20i18n=20keys=20(en/?= =?UTF-8?q?tr)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/client.ts | 13 ++++++- src/components/notes/note-file-preview.tsx | 45 +++++++++++++--------- src/components/notes/note-files-panel.tsx | 10 +---- src/i18n/messages.ts | 3 ++ src/pages/notes-page.tsx | 10 ++++- 5 files changed, 52 insertions(+), 29 deletions(-) diff --git a/src/api/client.ts b/src/api/client.ts index 144d37a..2671554 100644 --- a/src/api/client.ts +++ b/src/api/client.ts @@ -209,7 +209,18 @@ export async function blobClient(path: string, signal?: AbortSignal): Promise (props.file ? getNoteFileUrl(props.noteId, props.file.id) : ""); const type = () => props.file?.content_type ?? ""; @@ -25,16 +27,21 @@ export function NoteFilePreview(props: { noteId: string; file: NoteFile | null; if (currentUrl) URL.revokeObjectURL(currentUrl); currentUrl = ""; setPreviewUrl(""); + setPreviewError(""); const file = props.file; if (!file || !canPreview(file)) return; const controller = new AbortController(); - void getNoteFileBlob(props.noteId, file.id, controller.signal).then((blob) => { - if (controller.signal.aborted) return; - currentUrl = URL.createObjectURL(blob); - setPreviewUrl(currentUrl); - }); + void getNoteFileBlob(props.noteId, file.id, controller.signal) + .then((blob) => { + if (controller.signal.aborted) return; + currentUrl = URL.createObjectURL(blob); + setPreviewUrl(currentUrl); + }) + .catch((err) => { + if (!controller.signal.aborted) setPreviewError(formatApiError(err)); + }); onCleanup(() => { controller.abort(); @@ -69,19 +76,21 @@ export function NoteFilePreview(props: { noteId: string; file: NoteFile | null; when={canPreview(file())} fallback={

{t("notes.previewUnsupported")}

} > - {t("common.loading")}

}> - {file().name} -
- - - -
-
-
- -