-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Images can't be uploaded using WYSIWYG if media directory is a symlink #13929
Comments
@erikhansen, thank you for your report. |
Thank you, this is an important issue for us also. Is there a patch available for 2.2.3? |
@magento-engcom-team: can you point us to the commit where this is fixed in 2.3-develop? I have the feeling that we will run into the same problems due to the way how we deploy to the servers. |
I can confirm this behavior as well in 2.1.12. Can the backport also be considered for 2.1.x? |
I'm having the same issue on 2.1.12. |
Just ran into this issue, too. Here is the code I used to fix it (temporarily): etc/di.xml
Override/App/Filesystem/DirectoryResolver.php
|
@JosephMaxwell there's a typo in namespace in etc/di.xml
|
I solved with cweagans/composer-patches.
|
This presumably broke as part of the security patches (there's a bunch of stuff associated with path disclosures and RCEs in the 2.2.3 release). Anyone got any idea why this change was made? (so we don't set about reintroducing it with third party fixes) |
|
I'm working on it #distributed-cd |
…ory is a symlink - Added realpath() to root dir to resolve symlinks - Added tests
@andrewhowdencom - For the record, I much prefer to fix core issues like this using the cweagans/composer-patches approach that @osrecio mentioned above rather than using a preference. The reason for this is that if the underlying code changes in a future version of Magento (which is likely in this situation), the |
Yah that seems reasonable ^^ I packaged it as an extension for easy distribution so it hooks into our existing mechanisms for discovery by our team internally (namely, satis / bitbucket). I could further restrict it to the specific version of Magento (actually @mzeis spotted that) but it's a dirty temporary fix until core addresses it -- I hadn't put too much thought into managing it long term. |
Issue is reproducible on 2.3-develop branch. |
@erikhansen, thank you for your report. |
Is this fixed for 2.2.4 yet? |
@clementblanco It's fixed in 2.2.5. |
Still have this problem on 2.2.5 |
Same this problem on 2.1.14 |
@magento-engcom-team i have the same issue as @digvijay2017. File: Magento\Cms\Model\Wysiwyg\Images\Storage
|
Just tested this on 2.2-develop branch and it has been fixed there already. There is a commit for a reference: a6afb59 If someone still experience the issue, please provide more details |
I've just recently installed 2.2.5 in the past week after this was closed 9 days ago. I am still experiencing the issue with image uploads. |
Hi @TehJackal Could you please explain what is your setup? Regards, |
@TehJackal: that's a completely different error then what is discussed in this thread and has indeed nothing to do with symlinks. You might find a solution in the following thread though: #16531 (try installing the php extension 'fileinfo') |
This error is fixed in 2.2.5 |
Hi, This problem occurs on Magento 2.3.4 as well. 1- File validation fails if upload an image Fatal error: Uncaught Error: Call to undefined function mime_content_type() in
|
@tushhan: you need the Strictly speaking, it's a bug in Magento however, there is a suggestion to fix it, but might take a while until somebody picks it up. |
We got this error in 2.3.7-p1 in a very big project. The fix was to increase/deactive the max_session_size in admin. The cause was, that the current_path-variable couldn't be saved persistently in the session-object for the upload to work. |
thank you @pisarkov it worked in my case |
@pisarkov, It didn't work for me. Magento 2.4.3 |
@marcelloinfoweb what is the exact issue you are facing right now? |
message error in log: main.ERROR: Notice: Undefined index: force_static_path in /var/www/magento/vendor/magento/module-cms/Controller/Adminhtml/Wysiwyg/Images/OnInsert.php on line 57 |
@marcelloinfoweb Have you set the proper permissions to your magento folders? |
Getting same issue as @marcelloinfoweb @marcelloinfoweb - were you able to find a fix? |
As of 2.2.3, it's not possible to upload images via the WYSIWYG if the media directory is a symlink. This is due to this new file.
Preconditions
pub/media
directory should be a symlink that points somewhere else.Steps to reproduce
Expected result
Actual result
Workaround
UPDATE: As of Magento 2.2.5 / 2.3.0, this issue has been fixed and you shouldn't apply the patch below or else you'll break the functionality.
We've temporarily fixed this by changing this line from this:
to this (note the addition of the
realpath
function call):The text was updated successfully, but these errors were encountered: