fix: zip shouldn't include descript.ion

Massimo Melina committed Jan 18, 2025 at 16:35 UTC 9675e278ff35492f094aa455c0f91e8427fb9ff8
2 files changed +4 -3
src/api.get_file_list.ts
+1 -3
@@ -10,7 +10,7 @@ import { mapPlugins } from './plugins'
10 import { asyncGeneratorToArray, dirTraversal, pattern2filter, WHO_NO_ONE } from './misc'
11 import { HTTP_FOOL, HTTP_METHOD_NOT_ALLOWED, HTTP_NOT_FOUND } from './const'
12 import Koa from 'koa'
13 -import { descriptIon, DESCRIPT_ION, getCommentFor, areCommentsEnabled } from './comments'
13 +import { getCommentFor, areCommentsEnabled } from './comments'
14 import { basename } from 'path'
15 import { updateConnectionForCtx } from './connections'
16 import { ctxAdminAccess } from './adminApis'
@@ -70,8 +70,6 @@ export const get_file_list: ApiHandler = async ({ uri='/', offset, limit, search
70 for await (const sub of walker) {
71 let name = getNodeName(sub)
72 name = basename(name) || name // on windows, basename('C:') === ''
73 - if (descriptIon.get() && name === DESCRIPT_ION)
74 - continue
73 if (!filter(name))
74 continue
75 const entry = await nodeToDirEntry(ctx, sub)
src/vfs.ts
+3
@@ -15,6 +15,7 @@ import { ctxBelongsTo } from './perm'
15 import { getCurrentUsername } from './auth'
16 import { Stats } from 'node:fs'
17 import fswin from 'fswin'
18 +import { DESCRIPT_ION, descriptIon } from './comments'
19
20 const showHiddenFiles = defineConfig('show_hidden_files', false)
21
@@ -314,6 +315,8 @@ export async function* walkNode(parent: VfsNode, {
315 const {path} = entry
316 const isFolder = entry.isDirectory()
317 const name = prefixPath + (parent.rename?.[path] || path)
318 + if (descriptIon.get() && basename(name) === DESCRIPT_ION)
319 + continue
320 if (taken?.has(normalizeFilename(name))) continue
321 if (depth) {
322 const dir = dirname(name)