fix: (regression beta) timestamp not displayed on folders, even those with a source
Massimo Melina committed
Apr 6, 2025 at 12:08 UTC
db8c2dd8c81eb0b90cc803b35ab2fb32f5cf8243
2 files changed
+5
-2
src/api.get_file_list.ts
+4
-1
@@ -115,7 +115,10 @@ export const get_file_list: ApiHandler = async ({ uri='/', offset, limit, c, onl
115
return name ? { n: name, url, target: node.target } : null
116
const isFolder = await nodeIsDirectory(node)
117
try {
118
- const st = source && !isFolder ? node.stats || await stat(source) : undefined
118
+ const st = source ? node.stats || await stat(source).catch(e => {
119
+ if (!isFolder || !node.children?.length) // folders with virtual children, keep them
120
+ throw e
121
+ }) : undefined
122
const pl = node.can_list === WHO_NO_ONE ? 'l'
123
: !hasPermission(node, 'can_list', ctx) ? 'L'
124
: ''
src/api.vfs.ts
+1
-1
@@ -37,7 +37,7 @@ const apis: ApiHandlers = {
37
async function recur(node=vfs): Promise<VfsNodeAdminSend> {
38
const { source } = node
39
const stats = !source ? undefined : (node.stats || await stat(source!).catch(() => undefined))
40
- const isDir = !nodeIsLink(node) && (!source || (stats?.isDirectory() ?? node.children?.length! > 0))
40
+ const isDir = !nodeIsLink(node) && (!source || (stats?.isDirectory() ?? (source.endsWith('/') || node.children?.length! > 0)))
41
const copyStats: Pick<VfsNodeAdminSend, 'size' | 'birthtime' | 'mtime'> = stats ? _.pick(stats, ['size', 'birthtime', 'mtime'])
42
: { size: source ? -1 : undefined }
43
if (copyStats.mtime && (stats?.mtimeMs! - stats?.birthtimeMs!) < 1000)