Skip to content

Commit e469438

Browse files
authored
Merge pull request #1851 from nextcloud/bugfix/version-nagivate
2 parents 41c56b4 + 66179cc commit e469438

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

js/viewer-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/viewer-main.js.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: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export default {
230230
231231
filters: {
232232
uniqueKey(file) {
233-
return file.fileid || file.source
233+
return '' + file.fileid + file.source
234234
},
235235
},
236236
@@ -402,6 +402,27 @@ export default {
402402
'viewer--split': this.comparisonFile,
403403
}
404404
},
405+
406+
isSameFile() {
407+
return (fileInfo = null, path = null) => {
408+
if (
409+
path && path === this.currentFile.path
410+
&& !this.currentFile.source
411+
) {
412+
return true
413+
}
414+
415+
if (
416+
fileInfo && fileInfo.fileid === this.currentFile.fileid
417+
&& fileInfo.mtime && fileInfo.mtime === this.currentFile.mtime
418+
&& fileInfo.source && fileInfo.source === this.currentFile.source
419+
) {
420+
return true
421+
}
422+
423+
return false
424+
}
425+
},
405426
},
406427
407428
watch: {
@@ -563,7 +584,7 @@ export default {
563584
this.cancelRequestFile()
564585
565586
// do not open the same file again
566-
if (path === this.currentFile.path && !this.currentFile.source) {
587+
if (this.isSameFile(null, path)) {
567588
return
568589
}
569590
@@ -614,7 +635,7 @@ export default {
614635
this.cancelRequestFolder()
615636
616637
// do not open the same file info again
617-
if (fileInfo.basename === this.currentFile.basename && fileInfo.source !== this.currentFile.source) {
638+
if (this.isSameFile(fileInfo)) {
618639
return
619640
}
620641

0 commit comments

Comments
 (0)