Skip to content

Commit

Permalink
fix: website folders were out of order
Browse files Browse the repository at this point in the history
  • Loading branch information
rejetto committed Dec 13, 2023
1 parent b3b5133 commit dab5088
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion frontend/src/BrowseFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ const Entry = memo(({ entry, midnight, separator }: EntryProps) => {
},
}),
h('span', { className: 'link-wrapper' }, // container to handle mouse over for both children
isFolder ? h(Fragment, {},
isFolder && !entry.web ? h(Fragment, {}, // internal navigation, use Link component
h(Link, { to: uri }, ico, entry.n.slice(0,-1)),
// popup button is here to be able to detect link-wrapper:hover
file_menu_on_link && !showingButton && h('button', { className: 'popup-menu-button', onClick: fileMenu }, hIcon('menu'), t`Menu`)
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ export class DirEntry {
Object.assign(this, rest) // we actually allow any custom property to be memorized
this.n = n // must do it after rest to avoid overwriting
this.uri = rest?.url || ((n[0] === '/' ? '' : location.pathname) + pathEncode(this.n))
if (rest?.web) // this is actually a folder pointing to a default file, and it requires a final slash for correct handling
this.uri += '/'
this.isFolder = this.n.endsWith('/')
if (!this.isFolder) {
const i = this.n.lastIndexOf('.') + 1
Expand Down
4 changes: 2 additions & 2 deletions src/api.file_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ export const get_file_list: ApiHandler = async ({ uri, offset, limit, search, c
const name = getNodeName(node)
if (url)
return name ? { n: name, url } : null
if (!source)
if (!source) // virtual folder
return name ? { n: name + '/' } : null
if (node.isFolder && await hasDefaultFile(node))
return { n: name, web: true }
return { n: name + '/', web: true }
try {
const st = await stat(source)
const folder = st.isDirectory()
Expand Down

0 comments on commit dab5088

Please sign in to comment.