We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New language relevant PR in upstream repo: joomla/joomla-cms#39878 Here are the upstream changes:
diff --git a/administrator/components/com_media/resources/scripts/components/modals/create-folder-modal.vue b/administrator/components/com_media/resources/scripts/components/modals/create-folder-modal.vue index 99269aa27d795..50e5186565ea9 100644 --- a/administrator/components/com_media/resources/scripts/components/modals/create-folder-modal.vue +++ b/administrator/components/com_media/resources/scripts/components/modals/create-folder-modal.vue @@ -30,8 +30,31 @@ type="text" required autocomplete="off" + v-bind:class="(isValidName()!==0 && isValid())?'is-invalid':''" + aria-describedby="folderFeedback" @input="folder = $event.target.value" > + <div + v-if="isValidName()===1" + id="folderFeedback" + class="invalid-feedback" + > + {{ translate('COM_MEDIA_CREATE_NEW_FOLDER_RELATIVE_PATH_ERROR') }} + </div> + <div + v-if="isValidName()===2" + id="folderFeedback" + class="invalid-feedback" + > + {{ translate('COM_MEDIA_CREATE_NEW_FOLDER_EXISTING_FOLDER_ERROR') }} + </div> + <div + v-if="isValidName()===3 && isValid()" + id="folderFeedback" + class="invalid-feedback" + > + {{ translate('COM_MEDIA_CREATE_NEW_FOLDER_UNEXPECTED_CHARACTER') }} + </div> </div> </form> </div> @@ -46,7 +69,7 @@ </button> <button class="btn btn-success" - :disabled="!isValid()" + :disabled="!isValid() || isValidName()!==0" @click="save()" > {{ translate('JACTION_CREATE') }} @@ -70,6 +93,15 @@ export default { folder: '', }; }, + computed: { + /* Get the contents of the currently selected directory */ + items() { + const directories = this.$store.getters.getSelectedDirectoryDirectories; + const files = this.$store.getters.getSelectedDirectoryFiles; + + return [...directories, ...files]; + }, + }, watch: { '$store.state.showCreateFolderModal': function (show) { this.$nextTick(() => { @@ -79,11 +111,25 @@ export default { }); }, }, + methods: { /* Check if the form is valid */ isValid() { return (this.folder); }, + /* Check folder name is valid or not */ + isValidName() { + if (this.folder.includes('..')) { + return 1; + } + if ((this.items.filter((file) => file.name.toLowerCase() === (this.folder.toLowerCase())).length !== 0)) { + return 2; + } + if ((!/^[\p{L}\p{N}\-_. ]+$/u.test(this.folder))) { + return 3; + } + return 0; + }, /* Close the modal instance */ close() { this.reset(); diff --git a/administrator/components/com_media/tmpl/media/default_texts.php b/administrator/components/com_media/tmpl/media/default_texts.php index f112607d93b09..575c8511b774e 100644 --- a/administrator/components/com_media/tmpl/media/default_texts.php +++ b/administrator/components/com_media/tmpl/media/default_texts.php @@ -28,6 +28,9 @@ 'COM_MEDIA_CREATE_NEW_FOLDER', 'COM_MEDIA_CREATE_NEW_FOLDER_ERROR', 'COM_MEDIA_CREATE_NEW_FOLDER_SUCCESS', + 'COM_MEDIA_CREATE_NEW_FOLDER_EXISTING_FOLDER_ERROR', + 'COM_MEDIA_CREATE_NEW_FOLDER_RELATIVE_PATH_ERROR', + 'COM_MEDIA_CREATE_NEW_FOLDER_UNEXPECTED_CHARACTER', 'COM_MEDIA_DECREASE_GRID', 'COM_MEDIA_DELETE_ERROR', 'COM_MEDIA_DELETE_SUCCESS', diff --git a/administrator/language/en-GB/com_media.ini b/administrator/language/en-GB/com_media.ini index 26ae6e64dc30a..f8e617dc457a9 100644 --- a/administrator/language/en-GB/com_media.ini +++ b/administrator/language/en-GB/com_media.ini @@ -25,6 +25,9 @@ COM_MEDIA_COPY_FOLDER_NOT_POSSIBLE="Copy folder is not possible" COM_MEDIA_CREATE_NEW_FOLDER="Create New Folder" COM_MEDIA_CREATE_NEW_FOLDER_ERROR="Error creating folder." COM_MEDIA_CREATE_NEW_FOLDER_SUCCESS="Folder created." +COM_MEDIA_CREATE_NEW_FOLDER_EXISTING_FOLDER_ERROR="Folder or file name already exists " +COM_MEDIA_CREATE_NEW_FOLDER_RELATIVE_PATH_ERROR="Use of relative paths not permitted" +COM_MEDIA_CREATE_NEW_FOLDER_UNEXPECTED_CHARACTER="Only Alphanumeric ,underscore(_),hyphen(-) and peroid(.) are allowed" COM_MEDIA_DECREASE_GRID="Decrease grid size" COM_MEDIA_DELETE_ERROR="Error deleting the item." COM_MEDIA_DELETE_NOT_POSSIBLE="Delete not possible!"
The text was updated successfully, but these errors were encountered:
fix joomlagerman#3371
260d60f
translation
[5.2] Error handling while create folder in media manager new pr (#3375)
0da20d1
* add new strings * fix #3371 translation
tecpromotion
Successfully merging a pull request may close this issue.
New language relevant PR in upstream repo: joomla/joomla-cms#39878 Here are the upstream changes:
Click to expand the diff!
The text was updated successfully, but these errors were encountered: