Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

fix(frontend:spaces): prevent false positives when checking external location

johavenf1fdd0d4088e
diff --git a/frontend/src/app/applications/spaces/components/dialogs/space-root-path-dialog.component.ts b/frontend/src/app/applications/spaces/components/dialogs/space-root-path-dialog.component.ts
index 8f360f76..44cef335 100644
--- a/frontend/src/app/applications/spaces/components/dialogs/space-root-path-dialog.component.ts
+++ b/frontend/src/app/applications/spaces/components/dialogs/space-root-path-dialog.component.ts
@@ -63,7 +63,8 @@ export class SpaceRootPathDialogComponent implements OnInit {
this.newSpaceRoot.externalPath = '/' + this.newSpaceRoot.externalPath
}
for (const root of this.currentRoots) {
- if (this.newSpaceRoot.externalPath.startsWith(root.externalPath)) {
+ const normalizedRoot = root.externalPath[root.externalPath.length - 1] === '/' ? root.externalPath : `${root.externalPath}/`
+ if (this.newSpaceRoot.externalPath.startsWith(normalizedRoot)) {
this.rootPathIsValid = false
this.error = 'Parent location already exists in files'
return