fix: admin/monitoring: showing // on browsing
Massimo Melina committed
Dec 30, 2023 at 13:01 UTC
1b31ba955ccdd9ab2cc5c9e63372a8dd4c6b54be
1 file changed
+3
-3
src/api.get_file_list.ts
+3
-3
@@ -16,8 +16,8 @@ import { dontOverwriteUploading } from './upload'
16
17
export interface DirEntry { n:string, s?:number, m?:Date, c?:Date, p?: string, comment?: string, web?: boolean, url?: string }
18
19
-export const get_file_list: ApiHandler = async ({ uri, offset, limit, search, c, onlyFolders, admin }, ctx) => {
20
- const node = await urlToNode(uri || '/', ctx)
19
+export const get_file_list: ApiHandler = async ({ uri='/', offset, limit, search, c, onlyFolders, admin }, ctx) => {
20
+ const node = await urlToNode(uri, ctx)
21
const list = ctx.get('accept') === 'text/event-stream' ? new SendListReadable() : undefined
22
if (!node)
23
return fail(HTTP_NOT_FOUND)
@@ -43,7 +43,7 @@ export const get_file_list: ApiHandler = async ({ uri, offset, limit, search, c,
43
if (!list)
44
return { ...props, list: await asyncGeneratorToArray(produceEntries()) }
45
setTimeout(async () => {
46
- ctx.state.browsing = uri
46
+ ctx.state.browsing = uri.replace(/\/{2,}/g, '/')
47
updateConnection(getConnection(ctx)!, { ctx })
48
list.props(props)
49
for await (const entry of produceEntries())