diff options
Diffstat (limited to 'apps/files/src/components/FileEntry.vue')
-rw-r--r-- | apps/files/src/components/FileEntry.vue | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue index 275e8bb3aef..537279cabfe 100644 --- a/apps/files/src/components/FileEntry.vue +++ b/apps/files/src/components/FileEntry.vue @@ -232,12 +232,15 @@ import CustomElementRender from './CustomElementRender.vue' import CustomSvgIconRender from './CustomSvgIconRender.vue' import FavoriteIcon from './FavoriteIcon.vue' import logger from '../logger.js' +import { loadState } from '@nextcloud/initial-state' // The registered actions list const actions = getFileActions() Vue.directive('onClickOutside', vOnClickOutside) +const forbiddenCharacters = loadState('files', 'forbiddenCharacters', '') as string + export default Vue.extend({ name: 'FileEntry', @@ -810,6 +813,13 @@ export default Vue.extend({ throw new Error(this.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 })) + } + }) + return true }, checkIfNodeExists(name) { |