Skip to content

Commit b3ce7d4

Browse files
committed
fix(backend:files): correct isDir SQL logic to handle external paths without associated file IDs
1 parent bcc3ad2 commit b3ce7d4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

backend/src/applications/files/services/files-content-manager.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class FilesContentManager {
128128
}
129129
}
130130
} catch (e) {
131-
this.logger.warn(`${this.parseFiles.name} - ${context.indexSuffix} - unable to parse : ${dir} : ${e}`)
131+
this.logger.warn(`${this.parseFiles.name} - ${context.indexSuffix} - unable to parse: ${dir} - ${e}`)
132132
}
133133
}
134134

@@ -145,7 +145,7 @@ export class FilesContentManager {
145145
try {
146146
stats = await fs.stat(realPath)
147147
} catch (e) {
148-
this.logger.warn(`${this.analyzeFile.name} - unable to stats ${realPath} : ${e}`)
148+
this.logger.warn(`${this.analyzeFile.name} - unable to stats: ${realPath} - ${e}`)
149149
return null
150150
}
151151
if (stats.size === 0 || stats.size > this.maxDocumentSize) {
@@ -190,7 +190,7 @@ export class FilesContentManager {
190190
)
191191
return content.length ? content : null
192192
} catch (e) {
193-
this.logger.warn(`${this.parseContent.name} - unable to index : ${rPath} : ${e}`)
193+
this.logger.warn(`${this.parseContent.name} - unable to index: ${rPath} - ${e}`)
194194
}
195195
return null
196196
}

backend/src/applications/files/services/files-parser.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class FilesParser {
103103
id: shares.id,
104104
alias: shares.alias,
105105
externalPath: sql<string>`IF (${shares.externalPath} IS NOT NULL, ${shares.externalPath}, ${spacesRoots.externalPath})`,
106-
isDir: sql<boolean>`IF (${shares.externalPath} IS NOT NULL, 1, ${files.isDir})`,
106+
isDir: sql<boolean>`IF (${shares.externalPath} IS NOT NULL AND ${shares.fileId} IS NULL, 1, ${files.isDir})`,
107107
file: { path: sql<string>`IF (${files.id} IS NOT NULL, ${filePathSQL(files)}, '.')`, fromOwner: users.login, fromSpace: spaces.alias }
108108
})
109109
.from(shares)

0 commit comments

Comments
 (0)