Closed AndreKlang closed 5 years ago
Hi @AndreKlang. Thank you for your report. To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento-engcom-team give me {$VERSION} instance
where {$VERSION}
is version tags (starting from 2.2.0+) or develop branches (2.2-develop +).
For more details, please, review the Magento Contributor Assistant documentation.
@AndreKlang do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
@magento-engcom-team give me 2.2.4 instance
Hi @AndreKlang. Thank you for your request. I'm working on Magento 2.2.4 instance for you
Hi @AndreKlang, here is your Magento instance.
Admin access: https://i-16427-2-2-4.engcom.dev.magento.com/admin
Login: admin
Password: 123123q
Instance will be terminated in up to 3 hours.
@magento-engcom-team I confirm that I was able to reproduce the issue on vanilla Magento instance following steps to reproduce. However, in somewhat reverse order since I only had access to one working domain. So I first set Admin URL to "https://i-16427-2-2-4.engcom.dev.magento.com/" and then set base_url to "https://i-16427-2-2-4-frontend.engcom.dev.magento.com/".
Also, I noticed that the thumbnails on the image browser returned 404 (since the frontend-domain was used there), and the Preview image returned 500 (There has been an error processing your request)
@AndreKlang, thank you for your report. This issue is already fixed in Magento 2.3.
@engcom-backlog-pb Can you please reference in what issue/commit/pull-request this was solved?
@AndreKlang, unfortunately, no. WYSIWYG editor was totally reworked in Magento 2.3.
Any workarounds until Magento 2.3 release?
I've described my workaround on the StackExchange https://magento.stackexchange.com/a/238101/28975
Thanks for the workaround suggestion @troublediehard , this is a pretty serious issue as clients are unable to manage their content without a major upgrade.
As a suggestion, should this workaround be an adminhtml after plugin rather than a preference and string_replace the URL out of the returned value entirely (as the core code function does)?
/**
* Resolve issue with custom admin URL incompatibility with WYSIWYG admin CMS widget.
* @see https://github.com/magento/magento2/issues/16427
*
* @param Images $subject
* @param $result
* @return string
*/
public function afterGetImageHtmlDeclaration(
Images $subject,
$result
) {
$adminUrl = $this->scopeConfig->getValue('admin/url/custom');
return str_replace($adminUrl, '', $result);
}
@chris-pook there are things I don't like about both solutions, but since it is a workaround I think it's fine.
Hi @engcom-backlog-nazar. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:
[ ] 1. Add/Edit Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 2. Verify that the issue is reproducible on 2.3-develop
branchDetails
- Add the comment @magento-engcom-team give me 2.3-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop
branch, please, add the label Reproduced on 2.3.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
[ ] 3. Verify that the issue is reproducible on 2.2-develop
branch. Details
- Add the comment @magento-engcom-team give me 2.2-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.2-develop
branch, please add the label Reproduced on 2.2.x
[ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.
Hi @AndreKlang The issue was re-tested and we can confirm that it was fixed on the 2.3 release branch. We closing this issue as fixed due to upcoming 2.3 release that will be available soon.
Summary
If admin use a custom domain, different from the default website, the wysiwyg image-selector will return malformed media directives, causing broken links to images.
Expected directive: {{media url="wysiwyg/image.jpg"}} Returned directive: {{media url="http://backend.dev/media/wysiwyg/image.jpg"}}
This started when this was done: https://github.com/magento/magento2/issues/12147
Preconditions
web/unsecure/base_url
= "http://frontend.dev/" (Default Config)web/secure/base_url
= "http://frontend.dev/" (Default Config)cms/wysiwyg/use_static_urls_in_catalog
= 0Admin -> Stores -> Configuration -> Advanced -> Admin -> Admin Base URL
set Use Custom Admin URL to Yes, Set Custom Admin URL to "http://backend.dev/"Note: Both frontend.dev & backend.dev can be substituted by anything, but they both have to point to the same installation, and they HAVE to be different from each other.
Steps to reproduce
Admin -> Content -> Pages -> (edit any page)
Expected result
Actual result
Additional information
Reverting https://github.com/magento/magento2/commit/94fdca7b7a46eaf032c8314dc81428ba8aec1126 does fix this issue, but I feel that the issue originates from the method Magento\Cms\Helper\Wysiwyg\Images::getImageHtmlDeclaration().
Specifically these lines, if
$fileurl
and$mediaUrl
have different domains (witch they do in my case), the str_replace won't remove the domain-part. And I can't honestly tell if that is the intended purpose or "never supposed to happen"..Edit: Given that the frontend url was used in the thumbnails (observed here), I'd guess that there is a deeper issue regarding media-url's and custom admin-url.