fix: (regression 0.47.0) zip with selected not working when inside a folder
Massimo Melina committed
Aug 3, 2023 at 17:49 UTC
7fb1d3f6fa8f997bdeaf99b5ac717e91964bcd61
1 file changed
+3
-2
frontend/src/menu.ts
+3
-2
@@ -13,7 +13,7 @@ import { closeDialog } from '@hfs/shared/dialogs'
13
import { showUpload, uploadState } from './upload'
14
import { useSnapshot } from 'valtio'
15
import { apiCall } from '@hfs/shared/api'
16
-import { reloadList, usePath } from './useFetchList'
16
+import { reloadList } from './useFetchList'
17
import { t, useI18N } from './i18n'
18
19
export function MenuPanel() {
@@ -40,7 +40,8 @@ export function MenuPanel() {
40
}, [can_delete])
41
42
// passing files as string in the url should allow 1-2000 items before hitting the url limit of 64KB. Shouldn't be a problem, right?
43
- const list = useMemo(() => Object.keys(selected).map(s => s.endsWith('/') ? s.slice(0,-1) : s).join('*'), [selected])
43
+ const ofs = location.pathname.length
44
+ const list = useMemo(() => Object.keys(selected).map(s => s.slice(ofs, s.endsWith('/') ? -1 : Infinity)).join('*'), [selected])
45
46
// avoid useless dom changes while we are still waiting for necessary data
47
const [changingButton, setChangingButton] = useState('')