Skip to content
New issue

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

Removal of special characters from folder and file names #88

Open
twin-elements opened this issue Jul 28, 2021 · 4 comments
Open

Removal of special characters from folder and file names #88

twin-elements opened this issue Jul 28, 2021 · 4 comments

Comments

@twin-elements
Copy link

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?

@rmekni
Copy link

rmekni commented Sep 8, 2021

hey @twin-elements , did you find a way to do it?

@twin-elements
Copy link
Author

twin-elements commented Sep 8, 2021

Hi @rmekni
The only quick solution is to overwrite the controller and block a current version of the package in composer.json.
I will try to finish the modification to this manager soon and propose the changes to @artgris

@rmekni
Copy link

rmekni commented Sep 8, 2021

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

@Martin1982
Copy link
Contributor

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

$directory = $directorytmp = $fileManager->getCurrentPath().\DIRECTORY_SEPARATOR.$data['name'];

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants