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

2.2.0-dev - cms images are being added as __directive for path #7167

Closed
dmcmillin opened this issue Oct 24, 2016 · 19 comments
Closed

2.2.0-dev - cms images are being added as __directive for path #7167

dmcmillin opened this issue Oct 24, 2016 · 19 comments
Labels
bug report Component: Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line 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

@dmcmillin
Copy link

Preconditions

  1. php 5.6
  2. centos 6.5
  3. Magento 2.2.0-dev

Steps to reproduce

  1. create page in cms or block
  2. upload image using insert image

Expected result

  1. image should be in path http://www.examplesite.com/pub/media/xxx/xxx.etc

Actual result

  1. image path random in terms of letters and numbers but always contains links like below
    https://www.example.com/admin_url/cms/wysiwyg/directive/___directive/e3ttZWRpYSB1cmw9Ind5c2l3eWcvVmlkZW9zX2hvbWVwYWdlX3BpYy5qcGcifX0%2C/key/433d962b838e3448a2f0bf126627f57f98995b767c13bc09e8122e3b2501cdd6/
@palamar
Copy link
Contributor

palamar commented Oct 26, 2016

Such URL exists only on backend in WYSIWYG area, if you open CMS page/block on frontend URL will be like http://www.example.com/media/wysiwyg/.
Such behavior is not a bug.
If you see same URL on frontend as on backend, provide more details please.

@palamar palamar removed their assignment Oct 26, 2016
@dmcmillin
Copy link
Author

Nope. That url was taken from frontend. I am not getting media/wysiwyg

On Wed, Oct 26, 2016 at 7:48 AM, Mykola Palamar notifications@github.com
wrote:

Such URL exists only on backend in WYSIWYG area, if you open CMS
page/block on frontend URL will be like http://www.example.com/media/
wysiwyg/.
Such behavior is not a bug.
If you see same URL on frontend as on backend, provide more details
please.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#7167 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANFpTGu1ggmuVq0myMGTmZJ1cIPhftQsks5q32gvgaJpZM4KfSpi
.

Vasari Plaster and Stucco, LLC
Web Support Specialist
805-845-2497

@palamar
Copy link
Contributor

palamar commented Oct 27, 2016

I need more details, as in my case all works as expected.
Do you have additional stores, how you store images (filesystem or database), where HTTPS is turned on (only frontend, only backend, on both).
Thanks.

@dmcmillin
Copy link
Author

No additional stores. I have it stored as filesystem. HTTPS is disabled on frontend, enabled in admin.

@hostep
Copy link
Contributor

hostep commented Oct 27, 2016

@palamar: we also see this, see this slightly related issue: #7215

@Frits1980
Copy link

Duplicates: 5705

But even that ticket is still not solved. Mainly because developers cannot replicate the issue.
I just had it too. But I didn't have it before. Something changed. Still figuring out what though.

@dmcmillin
Copy link
Author

Unfortunately, no fixes yet for me and is probably related but not the same issue. Anyone have a fix for this?

@TommyKolkman
Copy link

I need this too, on 2.1.3! Anyone has a fix himself?!

@magentomaniac
Copy link

Still an issue in EE 2.1.4

@magentomaniac
Copy link

magentomaniac commented May 15, 2017

For anyone still struggling with this, we've came up with a fairly straightforward fix (props to the people at Vaimo). This was tested on EE 2.1.4

  1. Add this to <module_directory>etc/adminhtml/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
     <type name="Magento\Cms\Model\Wysiwyg\Config">
         <plugin name="add_wysiwyg_data" type="Vaimo\ModuleName\Plugin\WysiwygConfigPlugin" sortOrder="30" />
     </type>
</config>
  1. Create a Plugin at <module_directory>Plugin/WysiwygConfigPlugin.php with:
<?php
namespace Vaimo\ModuleName\Plugin;

use Magento\Cms\Model\Wysiwyg\Config;
use Magento\Framework\DataObject;

/**
 * Class to handle plugins on Magento\Cms\Model\Wysiwyg\Config
 */
class WysiwygConfigPlugin
{
 /**
 * Adds parameter to allow correct embedding of images
 *
 * @param Config $subject
 * @param DataObject $config
 *
 * @return DataObject
 */
 public function afterGetConfig(Config $subject, DataObject $config)
 {
 $config->addData(['add_directives' => true]);

 return $config;
 }
}
  1. Use this function in the template files to get the proper output.
    Otherwise it will contain directives (like {{media url=""}). This assumes that $block->getProduct() is available in the template. For example $block \Magento\Catalog\Block\Product\View\Description works fine.
<?php /* @escapeNotVerified */ echo $this->helper('Magento\Catalog\Helper\Output')->productAttribute($block->getProduct(), $block->getProduct()->getData('some_attribute'), 'some_attribute'); ?>

@IlnitskiyArtem
Copy link

@dmcmillin thank you for your report.
We have created internal ticket MAGETWO-58156

@veloraven veloraven added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Jun 19, 2017
@magento-engcom-team magento-engcom-team added bug report Component: Catalog develop Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Sep 11, 2017
@magento-engcom-team
Copy link
Contributor

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

@magento-engcom-team magento-engcom-team added 2.1.x 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 labels Oct 11, 2017
@magento-engcom-team magento-engcom-team added the Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release label Oct 11, 2017
@denysaw
Copy link

denysaw commented Nov 4, 2017

Yep. Same issue on 2.2

@jsiefer
Copy link

jsiefer commented Nov 28, 2017

The above pr fixed the issue for me.

@dverkade
Copy link
Member

Created a detailed description on how to reproduce this error in #12741 asked to reopen the PR of @jsiefer which fixed this issue. Let's hope this one gets merged and released in the next version, because it's quite a pain to work with the WYSIWYG editor right now.

@dverkade
Copy link
Member

This issue is fixed in Magento 2.2.2. I have tested this and works fine with this release of Magento. This issue can be closed.

@okorshenko
Copy link
Contributor

okorshenko commented Mar 5, 2018

Hi @dverkade thank you for deep research and linking all together. Closing this issue

Fixed in: #11048

@okorshenko okorshenko added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Mar 5, 2018
@treii28
Copy link

treii28 commented Jun 4, 2018

We upgraded to v2.2.2 and I'm still getting the issue. What is necessary to fix it as anything that manages to sneak into content with one of these __directive links hangs the process in apache in a 'closing' state that consumes 100cpu and don't go away until manually killed.

UPDATE: I searched the database to try to find links and didn't find any, so I searched the codebase instead. I noted in our version of the Cleversoft theme code it appears to be building urls similar to the ones that are hanging, but a third party developer we hired to customize our site built their changes over the top of the theme itself so we can't easily update it. I'm putting some fire on them to refactor their code so I can update the theme before doing further trouble-shooting as I suspect the [older] theme code as a potential source of our woes.

@luklewluk
Copy link
Contributor

luklewluk commented Sep 19, 2018

I had issues with wysiwyg images on Magento 2.2.2.
As I couldn't find ready solution anywhere, I'm sharing my observation here:
In file /vendor/magento/module-cms/Helper/Wysiwyg/Images.php there's a method isUsingStaticUrlsAllowed.
It passes "isAllowed" argument through event so you can easily override it in your code.

magento-engcom-team pushed a commit that referenced this issue Nov 9, 2021
B2B-2028: [AWS S3] [Integration Tests]: Investigate Test Failures in CustomerCustomAttributes module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line 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