From c5b89470fdc5bf9c7afa2f3626293e8d337b2181 Mon Sep 17 00:00:00 2001 From: cballevre Date: Mon, 18 Nov 2024 18:23:39 +0100 Subject: [PATCH] fix: Open public note inside shared cozy to cozy folder --- src/modules/navigation/PublicNoteRedirect.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/navigation/PublicNoteRedirect.tsx b/src/modules/navigation/PublicNoteRedirect.tsx index fb2e658903..8c491aa7ef 100644 --- a/src/modules/navigation/PublicNoteRedirect.tsx +++ b/src/modules/navigation/PublicNoteRedirect.tsx @@ -25,14 +25,20 @@ const PublicNoteRedirect: FC = () => { useEffect(() => { const fetchNoteUrl = async (fileId: string): Promise => { setFetchStatus('loading') + try { + // Inside notes, we need to add / at the end of /public/ or /preview/ to avoid 409 error + const pathname = + location.pathname === '/' + ? '/public/' + : joinPath(location.pathname, '') const url = await fetchURL( client, { id: fileId }, { - pathname: joinPath(location.pathname, '') + pathname } ) setNoteUrl(url)