Removal of special characters from folder and file names
twin-elements opened this issue · comments
Hi.
I need to be able to remove special characters and spaces when creating a new folder or a new file. Unfortunately, in Poland, some servers have a problem with paths that contain Polish characters. How can I do this?
hey @twin-elements , did you find a way to do it?
thanks @twin-elements for your reply,
For me, for files, just overrided the main controller uploadFileAction and UploadHandler's trim_file_name function to remove special chars, for folders, indexAction of the main controller, i created a helper that creates a yaml file that contains the original name and the filtered one then i just search for the original name for manager but i keep the filtered one for the web url
There are already some events available in the bundle where you can handle such things for some cases.
The one I don't see is for directories, you might want to create a PR where you dispatch an event at
And add a new event to https://github.com/artgris/FileManagerBundle/blob/master/Event/FileManagerEvents.php called PRE_CREATE_FOLDER
In your own application you can listen for this event and adjust the characters as required.