diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2022-10-14 10:52:24 +0300 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2022-10-19 18:52:23 +0300 |
commit | 3da00822d0846b3e56b7aee736b6e7679e3bf3c4 (patch) | |
tree | 58b2ee543beb2c19a4b02729dbc30b1c52443af6 /src/store/files.js | |
parent | 91d7e881507871f7fdc3ec20d247fdfd47b8020b (diff) |
Fix nomedia excludion
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'src/store/files.js')
-rw-r--r-- | src/store/files.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/store/files.js b/src/store/files.js index f0681860..6559ce69 100644 --- a/src/store/files.js +++ b/src/store/files.js @@ -25,7 +25,7 @@ import moment from '@nextcloud/moment' import { showError } from '@nextcloud/dialogs' import logger from '../services/logger.js' -import client from '../services/DavClient.js' +import client, { prefixPath } from '../services/DavClient.js' import Semaphore from '../utils/semaphoreWithPriority.js' const state = { @@ -41,10 +41,14 @@ const mutations = { * @param {Array} newFiles the store mutations */ updateFiles(state, newFiles) { + const files = {} newFiles.forEach(file => { - if (state.nomediaPaths.some(nomediaPath => file.filename.startsWith(nomediaPath))) { + // Ignore the file if the path is excluded + if (state.nomediaPaths.some(nomediaPath => file.filename.startsWith(nomediaPath) + || file.filename.startsWith(prefixPath + nomediaPath))) { return } + if (file.fileid >= 0) { file.fileMetadataSizeParsed = JSON.parse(file.fileMetadataSize?.replace(/"/g, '"') ?? '{}') file.fileMetadataSizeParsed.width = file.fileMetadataSizeParsed?.width ?? 256 @@ -58,11 +62,14 @@ const mutations = { file.timestamp = moment(file.lastmod).unix() // For sorting file.month = moment(file.lastmod).format('YYYYMM') // For grouping by month file.day = moment(file.lastmod).format('MMDD') // For On this day + + // Schedule the file to add + files[file.fileid] = file }) state.files = { ...state.files, - ...newFiles.reduce((files, file) => ({ ...files, [file.fileid]: file }), {}), + ...files, } }, |