fix: decode URL

This commit is contained in:
Henry Li
2026-01-18 20:26:01 +08:00
parent 5624b0cd38
commit c321c9293a
2 changed files with 2 additions and 2 deletions

View File

@@ -46,7 +46,7 @@ export function ArtifactFileDetail({
const filepath = useMemo(() => { const filepath = useMemo(() => {
if (isWriteFile) { if (isWriteFile) {
const url = new URL(filepathFromProps); const url = new URL(filepathFromProps);
return url.pathname; return decodeURIComponent(url.pathname);
} }
return filepathFromProps; return filepathFromProps;
}, [filepathFromProps, isWriteFile]); }, [filepathFromProps, isWriteFile]);

View File

@@ -22,7 +22,7 @@ export function FileViewer({
const { isCodeFile, language } = useMemo(() => { const { isCodeFile, language } = useMemo(() => {
if (isWriteFile) { if (isWriteFile) {
const url = new URL(filepath); const url = new URL(filepath);
const path = url.pathname; const path = decodeURIComponent(url.pathname);
return checkCodeFile(path); return checkCodeFile(path);
} }
return checkCodeFile(filepath); return checkCodeFile(filepath);