From 0b704c6c5888f7fdeb3d33a10330883ce8ab998f Mon Sep 17 00:00:00 2001 From: shimu <1239380544@qq.com> Date: Tue, 19 May 2026 13:56:10 +0800 Subject: [PATCH] =?UTF-8?q?=EF=BB=BFfix(frontend):=20fix=20new=20notebook?= =?UTF-8?q?=20URL=20using=20wrong=20file=20query=20param?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit newNotebookURL() was building ?file=__new__, but the backend's parse_file_key only recognises the exact sentinel __new__. The suffixed value was treated as a file path, causing a 404 on every new notebook open. Fix by separating the two concerns: pass file=__new__ as the notebook key and session_id= as the session identifier, consistent with how existing (unsaved) notebooks are linked from the home page. Co-authored-by: Cursor --- frontend/src/utils/urls.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/utils/urls.ts b/frontend/src/utils/urls.ts index f206632647d..bf3b4542f06 100644 --- a/frontend/src/utils/urls.ts +++ b/frontend/src/utils/urls.ts @@ -23,8 +23,9 @@ export function hasQueryParam(key: string, value?: string): boolean { export function newNotebookURL() { const sessionId = generateSessionId(); - const initializationId = `__new__${sessionId}`; - return asURL(`?file=${encodeURIComponent(initializationId)}`).toString(); + return asURL( + `?file=__new__&session_id=${encodeURIComponent(sessionId)}`, + ).toString(); } const urlRegex = /^(https?:\/\/\S+)$/;