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

The function "isUsingStaticUrlsAllowed" (configuration setting "cms/wysiwyg/use_static_urls_in_catalog") doesn't have any effect with the WYSIWYG editor image insertion #12147

Closed
andrewhowdencom opened this issue Nov 9, 2017 · 2 comments
Assignees
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@andrewhowdencom
Copy link
Contributor

Preconditions

  1. 2.2.1
  2. PHP 7.x

Steps to reproduce

  1. Set the setting "cms/wysiwyg/use_static_urls_in_catalog"
  2. Add an image using the WYSIWYG editor in the admin panel
  3. Observe that the directive style URL is returned, not the static URL

Expected result

  1. The static URL (i.e. media URL without transformation) should be returned

Actual result

The directive URL is returned.

Magento uses specially formatted URLs of the form:

https://${ADMIN_DOMAIN}/cms/wysiwyg/directive/___directive/e3ttZWRpYSB1cmw9Ind5c2l3eWcvYmVkMi5wbmcifX0,/key/${ADMIN_KEY}/

To be able to render images in the wysiwyg editor. These URLs have two purposes:

  1. They are able to be processed by the stack, and show the appropriate image, and
  2. They contain the CMS directive for insertion into the stack in base64 in the ___directive component.

However, in some situations stores may wish to disable this behaviour such that the URL is instead the standard URL for that scope:

https://${ADMIN_DOMAIN}/media/wysiwyg/bed2.png

This is controlled with the setting in the issue title. However, it currently has no effect. I think it likely broke here:

a978a4c

The controller on the frontend posts an empty store which s picked up by:

https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/OnInsert.php#L38

and stored as "". The problem is, the store configuration is either looking for a numeric store code, or the type null -- or it uses the configuration string exactly as supplied (i.e. ""):

https://github.com/magento/magento2/blame/2.2-develop/lib/internal/Magento/Framework/App/Config.php#L68

This malforms the path, queries the configuration tree but returns null. It is thus impossible to use that setting from the frontend.

It's possible that this is a bug in third party code, not supplying the string default in the post STORE. However, at this point I believe this to be a change in behaviour in upstream, and I will fix it accordingly.

Plan for this is just to check if store is "" in the OnInsert controller, and if it is, use null and not "".

@magento-engcom-team magento-engcom-team added Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed labels Nov 9, 2017
@magento-engcom-team
Copy link
Contributor

@andrewhowdencom, thank you for your report.
We've created internal ticket(s) MAGETWO-83828 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Nov 14, 2017
@nmalevanec nmalevanec self-assigned this Jan 11, 2018
@magento-team
Copy link
Contributor

Hi @andrewhowdencom. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1215 by @nmalevanec in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming patch release.

@magento-team magento-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Jan 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

5 participants