fix: admin/shared: home icon not working for paths with spaces

Massimo Melina committed May 22, 2026 at 17:31 UTC 6afe741ac9bb7132113e033ebdd1ae9c27b2bb0d
1 file changed +4 -3
admin/src/VfsTree.ts
+4 -3
@@ -9,7 +9,7 @@ import {
9 } from '@mui/icons-material'
10 import { Box, Typography } from '@mui/material'
11 import { deleteVfs, id2vfsNode, isDescendantUri, reindexVfs, VfsNodeAdmin } from './VfsPage'
12 -import { getOrSet, onlyTruthy, pathEncode, prefix, toMutable, wantArray, Who, with_ } from './misc'
12 +import { getOrSet, onlyTruthy, pathDecode, pathEncode, prefix, toMutable, wantArray, Who, with_ } from './misc'
13 import { Flex, iconTooltip, useToggleButton } from './mui'
14 import VfsMenuBar from './VfsMenuBar'
15 import { ApiObject } from './api'
@@ -32,6 +32,8 @@ export default function VfsTree({ statusApi }:{ statusApi: ApiObject }) {
32 const ref = useRef<HTMLLIElement | null>()
33 if (isRoot && ref.current)
34 ref.current.firstElementChild?.classList.toggle('Mui-selected', !(selectedFiles.length && !_.find(selectedFiles, { id: '/' })))
35 + const rootValue = pathDecode(id.slice(1))
36 + const rootFor = _.findKey(statusApi.data?.roots, v => v === rootValue)
37 return h(TreeItem, {
38 ref(el) {
39 if (el)
@@ -88,8 +90,7 @@ export default function VfsTree({ statusApi }:{ statusApi: ApiObject }) {
90 node.default && iconTooltip(Web, "Show as web-page"),
91 node.masks && iconTooltip(TheaterComedy, "Masks"),
92 node.size === -1 && iconTooltip(HighlightOff, "Source not found"),
91 - with_(_.findKey(statusApi.data?.roots, root => root === id.slice(1)), host =>
92 - host && iconTooltip(Home, `home for ${host}`))
93 + rootFor && iconTooltip(Home, `home for ${rootFor}`)
94 ),
95 ),
96 isRoot ? "Home folder" : name