TagSpaces is an offline, open source, document manager with tagging support
fix: Don't persist index for directories that no longer exist
Ilian Sapundshiev92c341178e32
diff --git a/src/renderer/hooks/LocationIndexContextProvider.tsx b/src/renderer/hooks/LocationIndexContextProvider.tsxindex b61120f38..4aa86acd6 100644--- a/src/renderer/hooks/LocationIndexContextProvider.tsx+++ b/src/renderer/hooks/LocationIndexContextProvider.tsx@@ -946,6 +946,15 @@ export const LocationIndexContextProvider = ({directoryPath = param;}const cLocation = findLocation(param?.locationID);+ // Don't persist index for directories that no longer exist —+ // would otherwise recreate deleted folders via the .ts subdir+ const parentExists = await cLocation.checkDirExist(directoryPath);+ if (!parentExists) {+ console.log(+ 'Skipping index persist — directory does not exist: ' + directoryPath,+ );+ return false;+ }const metaDirectory = getMetaDirectoryPath(directoryPath);const exist = await cLocation.checkDirExist(metaDirectory);try {