Fix issue where swiping a shared image without a directory made it disappear

This commit is contained in:
2026-10-02 15:22:02 +02:00
parent f5b9f543c6
commit 09fa193e9a

View File

@@ -52,14 +52,12 @@ export const update = async () => {
// Figure out if there are previous or next files. If not then we disable // Figure out if there are previous or next files. If not then we disable
// swiping controls in that direction // swiping controls in that direction
const siblings = await nav.get_siblings() const siblings = await nav.get_siblings()
for (let i = 0; i < siblings.length; i++) { const i = siblings.findIndex(s => s.name === nav.base.name)
if (siblings[i].name === nav.base.name) {
swipe_prev = i > 0 swipe_prev = i > 0
swipe_next = i < siblings.length-1 swipe_next = i !== -1 && i < siblings.length-1
if (i !== -1) {
preload(siblings[i-1]) preload(siblings[i-1])
preload(siblings[i+1]) preload(siblings[i+1])
break
}
} }
} }