From e554800193322d5b66a8ac33de629016eae62b47 Mon Sep 17 00:00:00 2001 From: butschster Date: Wed, 13 May 2026 08:20:37 +0400 Subject: [PATCH] fix: update attachment URLs for new server route layout Companion to buggregator/server#336. The server now namespaces attachment endpoints as /api/{module}/attachments/{eventUuid}[/{uuid}] so they no longer collide with module-specific 4-segment routes like /api/smtp/message/{uuid}/raw. --- src/shared/lib/io/use-attachments.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shared/lib/io/use-attachments.ts b/src/shared/lib/io/use-attachments.ts index 2d7e7b1e..16a3fe1a 100644 --- a/src/shared/lib/io/use-attachments.ts +++ b/src/shared/lib/io/use-attachments.ts @@ -15,7 +15,11 @@ export const useAttachments: TUseAttachments = (module: EventModule = 'smtp') => const headers = {"X-Auth-Token": token.value } - const calcDownloadLink = (id: EventId, attachmentId?: string): string => `${REST_API_URL}/api/${module}/${id}/attachments${attachmentId ? `/${attachmentId}` : ''}` + // The server namespaces attachment endpoints under `/api/{module}/attachments/...` + // (literal `attachments` segment first) to avoid colliding with module routes + // like `/api/smtp/message/{uuid}/raw`. See server: internal/server/http/attachments.go. + const calcDownloadLink = (id: EventId, attachmentId?: string): string => + `${REST_API_URL}/api/${module}/attachments/${id}${attachmentId ? `/${attachmentId}` : ''}` const getAttachments = (id: EventId) => fetch(calcDownloadLink(id), { headers }) .then((response) => response.json())