Skip to content

Commit 5725bd8

Browse files
committed
fix: report path for broken files as /-void/
1 parent c53107d commit 5725bd8

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/backend/src/filesystem/FSNodeContext.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,10 @@ module.exports = class FSNodeContext {
827827
.with('fs.fsentry:uuid')
828828
.obtain('fs.fsentry:path')
829829
.exec(this.uid ?? this.entry.uuid);
830+
831+
if ( fsentry.path && fsentry.path.startsWith('/-void/') ) {
832+
fsentry.broken = true;
833+
}
830834

831835
fsentry.dirname = _path.dirname(fsentry.path);
832836
fsentry.dirpath = fsentry.dirname;
@@ -856,8 +860,13 @@ module.exports = class FSNodeContext {
856860
// Use client-friendly IDs for shortcut_to
857861
fsentry.shortcut_to = (res.shortcut_to
858862
? await id2uuid(res.shortcut_to) : undefined);
859-
fsentry.shortcut_to_path = (res.shortcut_to
860-
? await id2path(res.shortcut_to) : undefined);
863+
try {
864+
fsentry.shortcut_to_path = (res.shortcut_to
865+
? await id2path(res.shortcut_to) : undefined);
866+
} catch (e) {
867+
fsentry.shortcut_invalid = true;
868+
fsentry.shortcut_uid = res.shortcut_to;
869+
}
861870

862871
// Add file_request_url
863872
if(res.file_request_token && res.file_request_token !== ''){

src/backend/src/filesystem/storage/DatabaseFSEntryService.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,11 @@ class DatabaseFSEntryService extends AdvancedBase {
250250
info.given('fs.fsentry:uuid').provide('fs.fsentry:path')
251251
.addStrategy('mysql', async uuid => {
252252
// TODO: move id2path here
253-
return await id2path(uuid);
253+
try {
254+
return await id2path(uuid);
255+
} catch (e) {
256+
return '/-void/' + uuid;
257+
}
254258
});
255259

256260
(async () => {

0 commit comments

Comments
 (0)