fix: (regression 0.43.0) wrong visualization of deeper items, searching

Massimo Melina committed Apr 20, 2023 at 11:10 UTC d2581f41a5afc73ca63c1e3c2bd2bcebe5aa9fa2
2 files changed +4 -3
frontend/src/BrowseFiles.ts
+3 -2
@@ -17,7 +17,7 @@ import { Checkbox, CustomCode, Spinner } from './components'
17 import { Head } from './Head'
18 import { state, useSnapState } from './state'
19 import { alertDialog } from './dialog'
20 -import useFetchList, { pathDecode, usePath } from './useFetchList'
20 +import useFetchList, { usePath } from './useFetchList'
21 import { useAuthorized } from './login'
22 import { acceptDropFiles, enqueue } from './upload'
23 import _ from 'lodash'
@@ -186,6 +186,7 @@ const Entry = memo(({ entry, midnight, separator }: EntryProps) => {
186 const [menuBtn, setMenuBtn] = useState(false)
187 const { showFilter, selected, can_delete } = useSnapState()
188 const containerDir = isFolder ? '' : uri.substring(0, uri.lastIndexOf('/')+1)
189 + const containerName = containerDir && entry.n.slice(0, -entry.name.length)
190 let className = isFolder ? 'folder' : 'file'
191 if (entry.cantOpen)
192 className += ' cant-open'
@@ -214,7 +215,7 @@ const Entry = memo(({ entry, midnight, separator }: EntryProps) => {
215 menuBtn && h('button', { className: 'popup-menu-button', onClick: openFileMenu }, hIcon('menu'), t`Menu`)
216 )
217 : h(Fragment, {},
217 - containerDir && h(Link, { to: base + containerDir, className:'container-folder' }, ico, pathDecode(containerDir) ),
218 + containerDir && h(Link, { to: base + containerDir, className:'container-folder' }, ico, containerName),
219 h('a', { href: uri, onClick }, !containerDir && ico, entry.name)
220 ),
221 h(CustomCode, { name: 'afterEntryName', props: { entry } }),
frontend/src/useFetchList.ts
+1 -1
@@ -122,7 +122,7 @@ export default function useFetchList() {
122 const t = add.m || add.c
123 if (t)
124 add.t = new Date(t)
125 - add.name = add.n.slice(add.n.lastIndexOf('/', -1) +1, add.isFolder ? -1 : Infinity)
125 + add.name = add.n.slice(add.n.lastIndexOf('/', add.n.length - 1) +1, add.isFolder ? -1 : Infinity)
126 add.cantOpen = add.p?.includes(add.isFolder ? 'l' : 'r') // to open we need list for folders and read for files
127
128 buffer.push(add)