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

Dynamic Media URLs in Products not working properly #7215

Closed
hostep opened this issue Oct 27, 2016 · 12 comments
Closed

Dynamic Media URLs in Products not working properly #7215

hostep opened this issue Oct 27, 2016 · 12 comments
Labels
bug report Component: Catalog 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

Comments

@hostep
Copy link
Contributor

hostep commented Oct 27, 2016

Preconditions

  1. Magento CE 2.1.2
  2. PHP 7.0.10

Steps to reproduce

  1. Make sure the setting Allow Dynamic Media URLs in Products and Categories is set to Yes (in Catalog)
  2. Make sure the setting Use Static URLs for Media Content in WYSIWYG for Catalog is set to No (in Content Management)
  3. Open an existing product or create a new one
  4. Go to the Description field
  5. Hide the editor
  6. Click the Insert Image... button
  7. Select an image and insert it
  8. The editor field now has something like this: <img src="{{media url="wysiwyg/abc.jpg"}}" alt="" />
  9. Save the product
  10. Go to the Description field again and hide the editor again

Expected result

  1. Expected result is that the description field still has: <img src="{{media url="wysiwyg/abc.jpg"}}" alt="" />

Actual result

  1. The media directive has been stripped apart:
    <img src="{{media url=" alt="" />

Discussion

This only seems to happen in products (maybe also categories). In CMS pages, this works as expected.

A second problem is if you do the same, but with the Editor enabled, and insert an image, it adds this html:
<img src="https://example.com/admin-url-identifier/cms/wysiwyg/directive/___directive/e3ttZWRpYSB1cmw9Ind5c2l3eWcvRFNDRjcxNjYuanBdqsfdqds/key/1b2f66950dc8519c79a63dc568af88e0731f5ca997f819cede1d1624d4fqsdfqsdf/" />
This is even worse, it leaks the admin-url-identifier to the outside world, which is probably a security issue?
And if you work with deploys with a current/releases/shared directory structure (capistrano for example), this image only works until you do a next deploy. After a deploy this url is broken and the image doesn't show up again in the frontend or adminhtml.
I would have expected that with the editor enabled, we also would get this {{media}} type of url instead of the weird url we now get.

@dthampy
Copy link
Contributor

dthampy commented Nov 4, 2016

Duplicate of #6138 which is already acknowledged internally
MAGETWO-59690( for 2.1) and MAGETWO-57796( for 2.2.0)

@dthampy dthampy added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Nov 4, 2016
@dthampy dthampy closed this as completed Nov 7, 2016
@developer-lindner
Copy link

developer-lindner commented Nov 23, 2016

@dthampy Just FYI... In version 2.1.2, media directives work (backend + frontend) for CMS pages , but not for product description and short description. Which i really don't understand... the same component should work properly everywhere and not just in one instance. I'm using this format by the way: {{media url=wysiwyg/icons/some_icon.png}}

Would be great if something crucial like this would be finally fixed in version 2.2.0 ;)

@mrtuvn
Copy link
Contributor

mrtuvn commented Jan 7, 2017

Current 2.1.3 i got same problem like this. Catalog Edit not work. Cms Page work

@Caryyon
Copy link

Caryyon commented Feb 10, 2017

Currently 2.1.4 and I'm still experiencing the same issue.

@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-70435

@afavata
Copy link

afavata commented Oct 19, 2017

Same issue with my instalaltion: Magento 2.2.0

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Oct 19, 2017
@Amadeco
Copy link

Amadeco commented Nov 9, 2017

Same issue with our current installation : Magento 2.2.1

@thaddeusmt
Copy link

I thought this was not resolved in 2.2, also. But Magento support said they could not reproduce it. So I created a new WYSIWYG text area attribute in attempt to reproduce this from "Step 1", and it did work.

So then I edited and re-saved my existing text area attributes - without changing any settings - and then my old attributes started processing the media url directives as well.

I'm not sure if the 2.2 upgrade forgot to update some table or something - but simply editing and re-saving the Attribute configuration in the Admin area resolved this, and the {{media}} directives are working on custom Product attributes now.

@welllin
Copy link

welllin commented Feb 26, 2018

Same issue with our current installation : Magento 2.2.2 Community Edition

When inserting a media file from categories Content -> Description

The following src tag:

<img src="{{media url="wysiwyg/case-studies-img3.jpg"}}" alt="" />

doesn't parse the string and display as it is in the page

<img src="{{media url=" wysiwyg="" case-studies-img3.jpg"}}"="" alt="">

@chonny
Copy link

chonny commented Mar 19, 2018

Any workarounds ?

@hostep
Copy link
Contributor Author

hostep commented Mar 19, 2018

Can someone who still runs into these problems try to reproduce this on a clean Magento installation (preferably using the latest versions, so version 2.1.12 and 2.2.3 at the time of writing), since I'm pretty sure this first got fixed in 2.1.8, broken again in 2.1.9 and then fixed again in 2.1.11 and also fixed in 2.2.1 or 2.2.2, but if you can reproduce this on a clean installation feel free let us know, or maybe better, create a new issue.

Thanks! :)

@skynixukraine
Copy link

On Magento 2.2.2 EE the issue still exists, dynamic urls do not work with:

  1. Product
  2. Category
  3. Content Banner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Catalog 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
Projects
None yet
Development

No branches or pull requests