@samitouri / QOSami-HFS / commits / 50183202

fix: admin/monitoring: showing // on browsing

Massimo Melina committed Dec 30, 2023 at 13:01 UTC 5018320280a697116b132f85a768d842983cf0e5
2 files changed +3 -4
src/api.file_list.ts
+3 -3
@@ -14,8 +14,8 @@ import { getConnection, updateConnection } from './connections'
14
15 export interface DirEntry { n:string, s?:number, m?:Date, c?:Date, p?: string, comment?: string, web?: boolean, url?: string }
16
17 -export const get_file_list: ApiHandler = async ({ uri, offset, limit, search, c }, ctx) => {
18 - const node = await urlToNode(uri || '/', ctx)
17 +export const get_file_list: ApiHandler = async ({ uri='/', offset, limit, search, c }, ctx) => {
18 + const node = await urlToNode(uri, ctx)
19 const list = ctx.get('accept') === 'text/event-stream' ? new SendListReadable() : undefined
20 if (!node)
21 return fail(HTTP_NOT_FOUND)
@@ -39,7 +39,7 @@ export const get_file_list: ApiHandler = async ({ uri, offset, limit, search, c
39 if (!list)
40 return { ...props, list: await asyncGeneratorToArray(produceEntries()) }
41 setTimeout(async () => {
42 - ctx.state.browsing = uri
42 + ctx.state.browsing = uri.replace(/\/{2,}/g, '/')
43 updateConnection(getConnection(ctx)!, { ctx })
44 list.props(props)
45 for await (const entry of produceEntries())
tests/config.yaml
-1
@@ -1,5 +1,4 @@
1 port: 81
2 -open_browser_at_start: false
2 allowed_referer: x.com
3 vfs:
4 masks: