Skip to content

Commit db3c220

Browse files
committed
fix: Avoid issues when switching between versions
Signed-off-by: Julius Härtl <[email protected]>
1 parent ffd1c24 commit db3c220

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

appinfo/info.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@
1515
<dependencies>
1616
<nextcloud min-version="28" max-version="28" />
1717
</dependencies>
18-
<default_enable />
1918
</info>

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)