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

File upload broken - using filterPathSegment breaks file extension from .extension to -extension #6

Open
lapp opened this issue May 10, 2024 · 2 comments

Comments

@lapp
Copy link

lapp commented May 10, 2024

Hi,

first, thanks a lot for your nice work!
While testing, I have found semantical mistake in File\Upload processor on line 162:
if ((boolean)$this->modx->getOption('upload_translit')) { $internalName = $this->modx->filterPathSegment($internalName); $internalName = $this->mediaSource->sanitizePath($internalName); }
The code above uses filterPathSegment method which is not suitable for file names, because it replaces the dot with the dash.
This leads in "file extension" error, becasue without the dot, there is simply no extension found.

@createit-ru
Copy link
Owner

Hi!
The problem is somewhat larger. If the upload_translit setting is enabled, then in some cases the file may still lose the extension dot. Look at this issue: modxcms/revolution#16551

@lapp
Copy link
Author

lapp commented May 13, 2024

Hi! The problem is somewhat larger. If the upload_translit setting is enabled, then in some cases the file may still lose the extension dot. Look at this issue: modxcms/revolution#16551

Hi, I suggest similar solution as mentioned here modxcms/revolution#16551 (comment)

Translit only the file name without extension and then append the extension...

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

2 participants