@samitouri / QOSami-HFS / commits / 3d09beaf

fix: custom icon file for a web link was not working

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