diff --git a/src/services/Viewer.js b/src/services/Viewer.js index 2678b263c..3636293c3 100644 --- a/src/services/Viewer.js +++ b/src/services/Viewer.js @@ -40,8 +40,8 @@ import Audios from '../models/audios.js' * File info type definition * * @typedef {object} Fileinfo - * @property {string} filename the file name - * @property {string} basename the full path of the file + * @property {string} filename File path of the remote item + * @property {string} basename Base filename of the remote item, no path * @property {?string} source absolute path of a non-dav file, e.g. a static resource or provided by an app route * @property {string} mime file MIME type in the format type/sub-type * @property {string} [previewUrl] URL of the file preview diff --git a/src/views/Viewer.vue b/src/views/Viewer.vue index c225293fc..a27b365f3 100644 --- a/src/views/Viewer.vue +++ b/src/views/Viewer.vue @@ -484,7 +484,7 @@ export default { files(fileList) { // the files list changed, let's update the current opened index - const currentIndex = fileList.findIndex(file => file.basename === this.currentFile.basename) + const currentIndex = fileList.findIndex(file => file.filename === this.currentFile.filename) if (currentIndex > -1) { this.currentIndex = currentIndex logger.debug('The files list changed, new current file index is ' + currentIndex) @@ -684,7 +684,7 @@ export default { this.fileList = this.files // store current position - this.currentIndex = this.fileList.findIndex(file => file.basename === fileInfo.basename) + this.currentIndex = this.fileList.findIndex(file => file.filename === fileInfo.filename) } else if (group && this.el === null) { const mimes = this.mimeGroups[group] ? this.mimeGroups[group] @@ -705,7 +705,7 @@ export default { this.fileList = filteredFiles.sort((a, b) => sortCompare(a, b, this.sortingConfig.key, this.sortingConfig.asc)) // store current position - this.currentIndex = this.fileList.findIndex(file => file.basename === fileInfo.basename) + this.currentIndex = this.fileList.findIndex(file => file.filename === fileInfo.filename) } else { this.currentIndex = 0 this.fileList = [fileInfo] @@ -1127,8 +1127,8 @@ export default { await axios.delete(url) emit('files:node:deleted', { fileid }) - // fileid is not unique, basename is - const currentIndex = this.fileList.findIndex(file => file.basename === this.currentFile.basename) + // fileid is not unique, basename is not unqiue, filename is + const currentIndex = this.fileList.findIndex(file => file.filename === this.currentFile.filename) if (this.hasPrevious || this.hasNext) { // Checking the previous or next file this.hasPrevious ? this.previous() : this.next()