Skip to content

Commit af49939

Browse files
FIX (storages): Do not allow to enter NAS path starting from slash
1 parent 72a02ad commit af49939

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

frontend/src/features/storages/ui/edit/storages/EditNASStorageComponent.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,24 @@ export function EditNASStorageComponent({ storage, setStorage, setIsUnsaved }: P
194194
onChange={(e) => {
195195
if (!storage?.nasStorage) return;
196196

197+
let pathValue = e.target.value.trim();
198+
// Remove leading slash if present
199+
if (pathValue.startsWith('/')) {
200+
pathValue = pathValue.substring(1);
201+
}
202+
197203
setStorage({
198204
...storage,
199205
nasStorage: {
200206
...storage.nasStorage,
201-
path: e.target.value.trim() || undefined,
207+
path: pathValue || undefined,
202208
},
203209
});
204210
setIsUnsaved(true);
205211
}}
206212
size="small"
207213
className="w-full max-w-[250px]"
208-
placeholder="/backups (optional)"
214+
placeholder="backups (optional, no leading slash)"
209215
/>
210216

211217
<Tooltip className="cursor-pointer" title="Subdirectory path within the share (optional)">

0 commit comments

Comments
 (0)