fix: # not supported in file name

Massimo Melina committed Dec 20, 2021 at 12:42 UTC 3a1666d6cf00e48e9ea9ab75035b3cda7c3214e5
4 files changed +5 -11
dev-notes.md
-7
@@ -1,13 +1,6 @@
1 -# What GUI lib?
2 -- none?
3 - - would none allow easier customization?
4 -- material
5 - - css+js https://materializecss.com/
6 -
1 # To do
2 - when reloading vfs wait for it to be unlocked
3 - sticky breadcrumbs
10 -- frontend: ensure icons are loaded before going on
4 - filter list
5 - search
6 try to use server-sent events for the reply
frontend/src/BrowseFiles.ts
+3 -2
@@ -60,9 +60,10 @@ function File({ n, m, c, s }: DirEntry) {
60 const base = usePath()
61 const isDir = n.endsWith('/')
62 const t = m||c ||null
63 + const href = n.replace(/#/g, encodeURIComponent)
64 return h('li', {},
64 - isDir ? h(Link, { to: base+n }, hIcon('folder'), n)
65 - : h('a', { href: n }, hIcon('file'), n),
65 + isDir ? h(Link, { to: base+href }, hIcon('folder'), n)
66 + : h('a', { href }, hIcon('file'), n),
67 h('div', { className:'entry-props' },
68 s !== undefined && h(Fragment, {},
69 h('span', { className:'entry-size' }, formatBytes(s)),
frontend/src/Head.ts
+1 -1
@@ -71,7 +71,7 @@ function FolderStats() {
71 function Breadcrumbs() {
72 const path = useLocation().pathname.slice(1,-1)
73 let prev = ''
74 - const breadcrumbs = path ? path.split('/').map(x => [prev = prev + x + '/', decodeURI(x)]) : []
74 + const breadcrumbs = path ? path.split('/').map(x => [prev = prev + x + '/', decodeURIComponent(x)]) : []
75 return h(Fragment, {},
76 h(Breadcrumb),
77 breadcrumbs.map(([path,label]) => h(Breadcrumb, { key: path, path, label }))
src/vfs.ts
+1 -1
@@ -78,7 +78,7 @@ export class Vfs {
78 async urlToNode(url: string, ctx: Koa.Context) {
79 const who = await getCurrentUser(ctx)
80 let run = this.root
81 - const rest = url.split('/').filter(Boolean)
81 + const rest = url.split('/').filter(Boolean).map(decodeURIComponent)
82 if (forbidden()) return
83 while (rest.length) {
84 let piece = rest.shift() as string