diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index 39cba0fc..997dc561 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -90,8 +90,8 @@ export default defineComponent({ }, methods: { - async open(photo: IPhoto | number, filename?: string, forceNative = false) { - if (!this.reducedOpen && this.native && (!photo || forceNative)) { + async open(photo: IPhoto | number, filename?: string, useNative = false) { + if (!this.reducedOpen && this.native && (!photo || useNative)) { // Open native sidebar this.native?.setFullScreenMode?.(true); this.native?.open(filename); diff --git a/src/components/viewer/Viewer.vue b/src/components/viewer/Viewer.vue index ac2e3aba..ef3fe4a6 100644 --- a/src/components/viewer/Viewer.vue +++ b/src/components/viewer/Viewer.vue @@ -1046,11 +1046,22 @@ export default defineComponent({ if (this.routeIsPublic || this.isLocal) { globalThis.mSidebar.open(photo); } else { - const fileInfo = (await dav.getFiles([photo]))[0]; - if (abort()) return; + // check if file path is already loaded with image info + let filename = photo.imageInfo?.filename; + let useNative = !!filename; - const forceNative = fileInfo?.originalFilename?.startsWith('/files/'); - globalThis.mSidebar.open(photo, fileInfo?.filename, forceNative); + // get filename from DAV if not already loaded + if (!filename) { + const fileInfo = (await dav.getFiles([photo]))[0]; + if (abort()) return; + + // get filename + filename = fileInfo?.filename; + useNative = fileInfo?.originalFilename?.startsWith('/files/'); + } + + // open sidebar + globalThis.mSidebar.open(photo, filename, useNative); } };