Add option(s) to sanitize filenames #7773
tiago-meireles
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Following this discussion here #1153 and with the improvements done in the version 3.0 of Payload, I think that it would be useful to add an option/options to the Upload Collection that allows the customization of the sanitization rules for filenames (similar to what other CMS allow to configure)
Currently Payload it's using https://github.com/parshap/node-sanitize-filename to sanitize filenames and it does not provide an option to extend/customize how the filenames should be sanitized.
This functionality would be extremely helpful when dealing with languages with specific special characters (like the Umlaut characters in the German language) or standardize the filenames for uploaded files .
Currently this can be achieved by creating a
beforeOperation
hook that sanitizes the filename when a file is uploaded, but I just wanted to know if this implementation makes sense or if we should keep it as simple as possible and simply use the hook?Beta Was this translation helpful? Give feedback.
All reactions