chore: pr feedbacks
This commit is contained in:
parent
5c67f2e665
commit
507e9a58de
3 changed files with 8 additions and 15 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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("/");
|
||||
|
|
|
|||
Loading…
Reference in a new issue