diff options
Diffstat (limited to 'apps/files/src/components/FileEntry/FileEntryName.vue')
-rw-r--r-- | apps/files/src/components/FileEntry/FileEntryName.vue | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/apps/files/src/components/FileEntry/FileEntryName.vue b/apps/files/src/components/FileEntry/FileEntryName.vue index 87859de353a..3b2faa4e506 100644 --- a/apps/files/src/components/FileEntry/FileEntryName.vue +++ b/apps/files/src/components/FileEntry/FileEntryName.vue @@ -70,7 +70,7 @@ import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js' import { useRenamingStore } from '../../store/renaming.ts' import logger from '../../logger.js' -const forbiddenCharacters = loadState('files', 'forbiddenCharacters', '') as string +const forbiddenCharacters = loadState<string[]>('files', 'forbiddenCharacters', []) export default Vue.extend({ name: 'FileEntryName', @@ -230,12 +230,10 @@ export default Vue.extend({ throw new Error(t('files', '{newName} already exists.', { newName: name })) } - const toCheck = trimmedName.split('') - toCheck.forEach(char => { - if (forbiddenCharacters.indexOf(char) !== -1) { - throw new Error(this.t('files', '"{char}" is not allowed inside a file name.', { char })) - } - }) + const char = forbiddenCharacters.find((char) => trimmedName.includes(char)) + if (char) { + throw new Error(t('files', '"{char}" is not allowed inside a file name.', { char })) + } return true }, |