From 3da00822d0846b3e56b7aee736b6e7679e3bf3c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Fri, 14 Oct 2022 09:52:24 +0200 Subject: Fix nomedia excludion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ Signed-off-by: nextcloud-command --- src/store/files.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/store/files.js') 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, } }, -- cgit v1.2.3