Skip to content

Commit 8fbc16a

Browse files
committed
fix(Viewer): add fallback title setter to handle case where filename is absent in path
Signed-off-by: Andrew Backhouse <andrew.backhouse@nextcloud.com>
1 parent 6494d59 commit 8fbc16a

5 files changed

Lines changed: 16 additions & 7 deletions

File tree

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/viewer-main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/* extracted by css-entry-points-plugin */
2-
@import './main-Ke6Ju54g.chunk.css';
2+
@import './main-Bg3U4zXh.chunk.css';
33
@import './previewUtils-DsspQ6dL.chunk.css';

js/viewer-main.mjs

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

js/viewer-main.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/views/Viewer.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,15 @@ export default defineComponent({
742742
this.handlerId = handler.id
743743
744744
this.currentFile = new File(fileInfo, mime, handler.component)
745+
746+
// if openFile() couldn’t derive a name from the path (e.g. "/" for single-file shares),
747+
// fall back to the displayname to set the title
748+
const title = document.getElementsByTagName('head')[0].getElementsByTagName('title')[0]
749+
if (title && !title.dataset.old && this.currentFile.displayname) {
750+
title.dataset.old = document.title
751+
this.updateTitle(this.currentFile.displayname)
752+
}
753+
745754
this.comparisonFile = null
746755
this.updatePreviousNext()
747756

0 commit comments

Comments
 (0)