chore: pr feedbacks

This commit is contained in:
Nicolas Meienberger 2026-02-21 10:14:16 +01:00
parent 5c67f2e665
commit 507e9a58de
3 changed files with 8 additions and 15 deletions

View file

@ -42,7 +42,6 @@ export function RestoreForm({ repository, snapshotId, returnPath, basePath }: Re
const volumeBasePath = basePath ?? "/";
const [waitingForDownload, setWaitingForDownload] = useState(false);
const [restoreLocation, setRestoreLocation] = useState<RestoreLocation>("original");
const [customTargetPath, setCustomTargetPath] = useState("");
const [overwriteMode, setOverwriteMode] = useState<OverwriteMode>("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
<Tooltip>
<TooltipTrigger asChild>
<span className="inline-flex">
<Button variant="outline" onClick={handleDownload} disabled={!canDownload} loading={waitingForDownload}>
<Button variant="outline" onClick={handleDownload} disabled={!canDownload}>
<Download className="h-4 w-4 mr-2" />
{getDownloadButtonText()}
</Button>

View file

@ -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 (

View file

@ -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("/");