You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to restrict dot in resource aliases, but related setting affects uploaded files.
Step to reproduce
On fresh modx installed, add . to friendly_alias_restrict_chars_pattern system setting default value (for exclude dot in resource aliases in my case)
Setting value become to /[\0\x0B\t\n\r\f\a&=+%#<>"~:`@\?\[\]\{\}\|\^'\\.]/
Then try to upload file with name te st.txt via media manager.
Observed behavior
After upload, you get te-sttxt (without dot before .txt extension)
If i disable upload_translit setiing, file name become to te st.txt → unsafe, non-friendly-url compatible an poor looking. May contain special chars and etc.
Expected behavior
Dots in file extensions (and other dots may be via special pattern) preserved when upload or remane file via media manager.
It will be great to set up RegExp pattenrs for uploaded file names and for fliendly URLs separately!
dimasites
changed the title
[3.x] File extension drops upload_translit when friendly url pattern restricts dot
[3.x] File extension drops in media manager when friendly url pattern restricts dot
Mar 28, 2024
In other systems, I remove the file extension, sanitize the file name, and then append an extension based on the file's Mime type. I do this because the extension isn't always right; sometimes for innocent reasons (a PNG with a .jpg extension) and other times to circumvent restrictions.
Either a separate system setting for each regex or removing the file extension/appending a new file extension after sanitization would avoid this problem.
Bug report
Summary
I want to restrict dot in resource aliases, but related setting affects uploaded files.
Step to reproduce
On fresh modx installed, add
.
tofriendly_alias_restrict_chars_pattern
system setting default value (for exclude dot in resource aliases in my case)Setting value become to
/[\0\x0B\t\n\r\f\a&=+%#<>"~:`@\?\[\]\{\}\|\^'\\.]/
Then try to upload file with name
te st.txt
via media manager.Observed behavior
After upload, you get
te-sttxt
(without dot before .txt extension)If i disable
upload_translit
setiing, file name become tote st.txt
→ unsafe, non-friendly-url compatible an poor looking. May contain special chars and etc.Expected behavior
Dots in file extensions (and other dots may be via special pattern) preserved when upload or remane file via media manager.
It will be great to set up RegExp pattenrs for uploaded file names and for fliendly URLs separately!
Environment
MODX 3.0.4.
upload_translit
setiing activated (by default) andfriendly_alias_restrict_chars
=pattern
(by default)The text was updated successfully, but these errors were encountered: