TagSpaces is an offline, open source, document manager with tagging support
TSN503 - switching s3 locations with no path broken (#1250)
Stanimire0da48d7b85e
diff --git a/app/utils/paths.ts b/app/utils/paths.tsindex 1522934ed..565948924 100644--- a/app/utils/paths.ts+++ b/app/utils/paths.ts@@ -355,14 +355,21 @@ export function extractTags(}export function extractLocation(filePath: string, locations: Array<Location>) {+ let currentLocation;const path = filePath.replace(/[/\\]/g, '');for (let i = 0; i < locations.length; i += 1) {const locationPath = locations[i].path? locations[i].path.replace(/[/\\]/g, ''): locations[i].paths[0].replace(/[/\\]/g, '');- if (path.startsWith(locationPath)) {- return locations[i];++ // Handle S3 empty location+ if (locationPath.length === 0) {+ if (currentLocation === undefined) {+ currentLocation = locations[i];+ }+ } else if (path.startsWith(locationPath)) {+ currentLocation = locations[i];}}- return undefined;+ return currentLocation;}