@samitouri / QOSami-HFS / commits / d65d7d08

fix: malformed basic-web html

Massimo Melina committed Jun 9, 2024 at 10:58 UTC d65d7d084ef0032fd508bde35612506ff50cf14f
2 files changed +7 -4
src/basicWeb.ts
+2 -2
@@ -44,8 +44,8 @@ export function basicWeb(ctx: Koa.Context, node: VfsNode) {
44 stream.push(_.map(links, (v,k) => a(k, v)).join(' ') + '\n<ul>\n')
45 if (ctx.state.originalPath.length > 1)
46 stream.push('<li>' + a('..' + force, '..') + '\n')
47 - stream.push('</ul>\n')
48 - stream.push(getSection('basicFooter'))
47 + stream.on('ending', () =>
48 + stream.push('</ul>\n' + getSection('basicFooter')) )
49 return true
50 }
51
src/misc.ts
+5 -2
@@ -80,8 +80,11 @@ export function asyncGeneratorToReadable<T>(generator: AsyncIterable<T>) {
80 void iterator.return?.()
81 },
82 read() {
83 - iterator.next().then(it =>
84 - this.push(it.done ? null : it.value))
83 + iterator.next().then(it => {
84 + if (it.done)
85 + this.emit('ending')
86 + return this.push(it.done ? null : it.value)
87 + })
88 }
89 })
90 }