fix: website folders were out of order
Massimo Melina committed
Dec 12, 2023 at 17:35 UTC
dab508801ae08edfb48d2f0fa49af7986e5f02ca
3 files changed
+3
-5
frontend/src/BrowseFiles.ts
+1
-1
@@ -213,7 +213,7 @@ const Entry = memo(({ entry, midnight, separator }: EntryProps) => {
213
},
214
}),
215
h('span', { className: 'link-wrapper' }, // container to handle mouse over for both children
216
- isFolder ? h(Fragment, {},
216
+ isFolder && !entry.web ? h(Fragment, {}, // internal navigation, use Link component
217
h(Link, { to: uri }, ico, entry.n.slice(0,-1)),
218
// popup button is here to be able to detect link-wrapper:hover
219
file_menu_on_link && !showingButton && h('button', { className: 'popup-menu-button', onClick: fileMenu }, hIcon('menu'), t`Menu`)
frontend/src/state.ts
-2
@@ -100,8 +100,6 @@ export class DirEntry {
100
Object.assign(this, rest) // we actually allow any custom property to be memorized
101
this.n = n // must do it after rest to avoid overwriting
102
this.uri = rest?.url || ((n[0] === '/' ? '' : location.pathname) + pathEncode(this.n))
103
- if (rest?.web) // this is actually a folder pointing to a default file, and it requires a final slash for correct handling
104
- this.uri += '/'
103
this.isFolder = this.n.endsWith('/')
104
if (!this.isFolder) {
105
const i = this.n.lastIndexOf('.') + 1
src/api.file_list.ts
+2
-2
@@ -101,10 +101,10 @@ export const get_file_list: ApiHandler = async ({ uri, offset, limit, search, c
101
const name = getNodeName(node)
102
if (url)
103
return name ? { n: name, url } : null
104
- if (!source)
104
+ if (!source) // virtual folder
105
return name ? { n: name + '/' } : null
106
if (node.isFolder && await hasDefaultFile(node))
107
- return { n: name, web: true }
107
+ return { n: name + '/', web: true }
108
try {
109
const st = await stat(source)
110
const folder = st.isDirectory()