TagSpaces is an offline, open source, document manager with tagging support
fix: improve getAllPropertiesPromise function
Ilian Sapundshievc240706f1e95
diff --git a/app/services/utils-io.ts b/app/services/utils-io.tsindex 5cb403e3b..44bb43a6e 100644--- a/app/services/utils-io.ts+++ b/app/services/utils-io.ts@@ -247,22 +247,19 @@ export async function getAllPropertiesPromise(): Promise<FileSystemEntry> {const entryProps = await PlatformIO.getPropertiesPromise(entryPath);let metaFilePath;- if (entryProps.isFile) {- metaFilePath = getMetaFileLocationForFile(- entryPath,- PlatformIO.getDirSeparator()- );- } else {- metaFilePath = getMetaFileLocationForDir(- entryPath,- PlatformIO.getDirSeparator()- );- }- const metaFileProps = await PlatformIO.getPropertiesPromise(metaFilePath);- if (metaFileProps.isFile) {- entryProps.meta = await loadJSONFile(metaFilePath);+ const dirSep = PlatformIO.getDirSeparator();+ if (entryProps) {+ metaFilePath = entryProps.isFile+ ? getMetaFileLocationForFile(entryPath, dirSep)+ : getMetaFileLocationForDir(entryPath, dirSep);+ const metaFileProps = await PlatformIO.getPropertiesPromise(metaFilePath);+ if (metaFileProps.isFile) {+ entryProps.meta = await loadJSONFile(metaFilePath);+ }+ return enhanceEntry(entryProps);}- return enhanceEntry(entryProps);+ console.warn('Error getting props for ' + entryPath);+ return entryProps;}export async function loadJSONFile(filePath: string) {