fix: admin/shared: home icon not working for paths with spaces
Massimo Melina committed
May 22, 2026 at 17:31 UTC
cf2632513e3277ea9d5f5788b52db133e908d838
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 { onlyTruthy, pathEncode, prefix, toMutable, wantArray, WhoVfs, with_ } from './misc'
12
+import { onlyTruthy, pathDecode, pathEncode, prefix, toMutable, wantArray, WhoVfs, 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
ref.current = el
@@ -84,8 +86,7 @@ export default function VfsTree({ statusApi }:{ statusApi: ApiObject }) {
86
node.default && iconTooltip(Web, "Show as web-page"),
87
node.masks && iconTooltip(TheaterComedy, "Masks"),
88
node.size === -1 && iconTooltip(HighlightOff, "Source not found"),
87
- with_(_.findKey(statusApi.data?.roots, root => root === id.slice(1)), host =>
88
- host && iconTooltip(Home, `home for ${host}`))
89
+ rootFor && iconTooltip(Home, `home for ${rootFor}`)
90
),
91
),
92
isRoot ? "Home folder" : name