From 507e9a58de175b66e0a274ff641e257831894384 Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Sat, 21 Feb 2026 10:14:16 +0100 Subject: [PATCH] chore: pr feedbacks --- app/client/components/restore-form.tsx | 6 +----- app/server/utils/restic.ts | 10 +--------- app/utils/path.ts | 7 ++++++- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/app/client/components/restore-form.tsx b/app/client/components/restore-form.tsx index add9f38e..44536073 100644 --- a/app/client/components/restore-form.tsx +++ b/app/client/components/restore-form.tsx @@ -42,7 +42,6 @@ export function RestoreForm({ repository, snapshotId, returnPath, basePath }: Re const volumeBasePath = basePath ?? "/"; - const [waitingForDownload, setWaitingForDownload] = useState(false); const [restoreLocation, setRestoreLocation] = useState("original"); const [customTargetPath, setCustomTargetPath] = useState(""); const [overwriteMode, setOverwriteMode] = useState("always"); @@ -151,8 +150,6 @@ export function RestoreForm({ repository, snapshotId, returnPath, basePath }: Re ]); const handleDownload = useCallback(() => { - setWaitingForDownload(true); - if (selectedPaths.size > 1) { return; } @@ -177,7 +174,6 @@ export function RestoreForm({ repository, snapshotId, returnPath, basePath }: Re document.body.appendChild(link); link.click(); document.body.removeChild(link); - setWaitingForDownload(false); }, [repository.shortId, snapshotId, selectedPathKind, selectedPaths]); const acknowledgeRestoreResult = useCallback(() => { @@ -228,7 +224,7 @@ export function RestoreForm({ repository, snapshotId, returnPath, basePath }: Re - diff --git a/app/server/utils/restic.ts b/app/server/utils/restic.ts index 6b22203a..6c710977 100644 --- a/app/server/utils/restic.ts +++ b/app/server/utils/restic.ts @@ -563,15 +563,7 @@ const normalizeDumpPath = (pathToDump?: string): string => { return "/"; } - const decodedPath = (() => { - try { - return decodeURIComponent(trimmedPath); - } catch { - return trimmedPath; - } - })(); - - return normalizeAbsolutePath(decodedPath); + return normalizeAbsolutePath(trimmedPath); }; const dump = async ( diff --git a/app/utils/path.ts b/app/utils/path.ts index 0011a196..2d7af102 100644 --- a/app/utils/path.ts +++ b/app/utils/path.ts @@ -2,7 +2,12 @@ export const normalizeAbsolutePath = (value?: string): string => { const trimmed = value?.trim(); if (!trimmed) return "/"; - const normalizedInput = decodeURIComponent(trimmed).replace(/\\+/g, "/"); + let normalizedInput: string; + try { + normalizedInput = decodeURIComponent(trimmed).replace(/\\+/g, "/"); + } catch { + normalizedInput = trimmed.replace(/\\+/g, "/"); + } const withLeadingSlash = normalizedInput.startsWith("/") ? normalizedInput : `/${normalizedInput}`; const parts = withLeadingSlash.split("/");