fix: custom icon file for a web link was not working
Massimo Melina committed
May 24, 2026 at 00:58 UTC
9b60a41cfaac9cd182eb8f559f4b4e2225610853
2 files changed
+6
-4
frontend/src/BrowseFiles.ts
+5
-3
@@ -192,8 +192,10 @@ function FilesList() {
192
}
193
}, [focus, focusSkip])
194
useEffect(() => { // wait for possible page-change before focusing
195
- if (focusIndex >= 0)
196
- (document.querySelector(`a[href="${theList[focusIndex]?.uri}"]`) as HTMLElement)?.focus()
195
+ if (focusIndex < 0) return
196
+ const e = theList[focusIndex]
197
+ if (!e) return
198
+ (document.querySelector(`a[href="${e.url || e.uri}"]`) as HTMLElement)?.focus()
199
}, [focusIndex])
200
201
const ref = useRef<HTMLElement>()
@@ -363,7 +365,7 @@ const Entry = ({ entry, midnight, separator }: EntryProps) => {
365
}),
366
h('span', { className: 'link-wrapper' }, // container to handle mouse over for both children
367
// we treat webpages as folders, with menu to comment
366
- !isFolder ? h('a', { href: uri, ...commonProps, target: entry.target, rel: entry.target && 'noopener noreferrer' })
368
+ !isFolder ? h('a', { href: entry.url || uri, ...commonProps, target: entry.target, rel: entry.target && 'noopener noreferrer' })
369
: h(Fragment, {},
370
// without reloadDocument, once you enter the web page, the back button won't bring you back to the frontend
371
h(Link, { to: uri, reloadDocument: entry.web, ...commonProps }), // Link = internal navigation
frontend/src/state.ts
+1
-1
@@ -118,7 +118,7 @@ export class DirEntry implements ServerDirEntry {
118
n = n.slice(0, -1)
119
Object.assign(this, rest) // we actually allow any custom property to be memorized
120
this.n = n // must do it after 'rest' to avoid overwriting
121
- this.uri = rest?.url || ((!n || n[0] === '/' ? '' : location.pathname) + pathEncode(n) + (this.isFolder ? '/' : ''))
121
+ this.uri = (!n || n[0] === '/' ? '' : location.pathname) + pathEncode(n) + (this.isFolder ? '/' : '')
122
if (!this.isFolder) {
123
const i = n.lastIndexOf('.') + 1
124
this.ext = i ? n.substring(i).toLowerCase() : ''