Skip to content

TagSpaces is an offline, open source, document manager with tagging support

Issue with not connected folders (#2102)

Stanimir55229d386fa8
diff --git a/src/renderer/hooks/DirectoryContentContextProvider.tsx b/src/renderer/hooks/DirectoryContentContextProvider.tsx
index a613d21b9..9de9c4b7a 100644
--- a/src/renderer/hooks/DirectoryContentContextProvider.tsx
+++ b/src/renderer/hooks/DirectoryContentContextProvider.tsx
@@ -752,22 +752,30 @@ export const DirectoryContentContextProvider = ({
location: CommonLocation = undefined,
): Promise<boolean> {
if (dirPath !== undefined) {
- const reloadMeta =
- cleanTrailingDirSeparator(currentDirectoryPath.current) ===
- cleanTrailingDirSeparator(dirPath);
- return loadMetaDirectoryContent(
- dirPath,
- location || currentLocation,
- showHiddenEntries,
- ).then((dirEntries) => {
- if (dirEntries && reloadMeta) {
- // load meta files (reload of the same directory is not handled from ThumbGenerationContextProvider)
- return loadCurrentDirMeta(dirPath, dirEntries).then((entries) => {
- updateCurrentDirEntries(entries);
+ const cLocation = location || currentLocation;
+ return cLocation.checkDirExist(dirPath).then((exist) => {
+ if (exist) {
+ const reloadMeta =
+ cleanTrailingDirSeparator(currentDirectoryPath.current) ===
+ cleanTrailingDirSeparator(dirPath);
+ return loadMetaDirectoryContent(
+ dirPath,
+ cLocation,
+ showHiddenEntries,
+ ).then((dirEntries) => {
+ if (dirEntries && reloadMeta) {
+ // load meta files (reload of the same directory is not handled from ThumbGenerationContextProvider)
+ return loadCurrentDirMeta(dirPath, dirEntries).then((entries) => {
+ updateCurrentDirEntries(entries);
+ return true;
+ });
+ }
return true;
});
+ } else {
+ showNotification(t('core:invalidLink'), 'warning', true);
+ return false;
}
- return true;
});
}
return Promise.resolve(false);
diff --git a/src/renderer/hooks/OpenedEntryContextProvider.tsx b/src/renderer/hooks/OpenedEntryContextProvider.tsx
index 10031342d..59c166fad 100644
--- a/src/renderer/hooks/OpenedEntryContextProvider.tsx
+++ b/src/renderer/hooks/OpenedEntryContextProvider.tsx
@@ -732,13 +732,7 @@ export const OpenedEntryContextProvider = ({
directoryPath,
);
- targetLocation.checkDirExist(dirFullPath).then((exist) => {
- if (exist) {
- openDirectory(dirFullPath, undefined, targetLocation);
- } else {
- showNotification(t('core:invalidLink'), 'warning', true);
- }
- });
+ openDirectory(dirFullPath, undefined, targetLocation);
} else {
openDirectory(locationPath, undefined, targetLocation);
}