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
[AdminBundle] Fix escaping of img src attributes in WYSIWYG fields #1858
Conversation
The same seems to be happening to href-attributes of a-tags. Could this PR
be extended to fix that too?
…On Mar 1, 2018 18:02, "Mark Northrop" ***@***.***> wrote:
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets #1857
<#1857>
The MediaTokenTransformer::reverseTransform() method uses the
Crawler::html() method to produce the HTML it returns, but this method
automatically URL-encodes the src attribute of image tags.
This PR does a search and replace on the final HTML to make sure that the
square brackets used for the tokens are preserved.
*NB: the Symfony docs mention that the DomCrawler Component is not
designed to re-dump HTML, and so it might be worth considering looking for
a different tool to use in this class. (See
https://symfony.com/doc/current/components/dom_crawler.html#component-dom-crawler-dumping
<https://symfony.com/doc/current/components/dom_crawler.html#component-dom-crawler-dumping>).*
------------------------------
You can view, comment on, or merge this pull request online at:
#1858
Commit Summary
- Escape square brackets in img tags
File Changes
- *M* src/Kunstmaan/AdminBundle/Form/MediaTokenTransformer.php
<https://github.com/Kunstmaan/KunstmaanBundlesCMS/pull/1858/files#diff-0>
(15)
- *A* src/Kunstmaan/AdminBundle/Tests/Form/
MediaTokenTransformerTest.php
<https://github.com/Kunstmaan/KunstmaanBundlesCMS/pull/1858/files#diff-1>
(37)
Patch Links:
- https://github.com/Kunstmaan/KunstmaanBundlesCMS/pull/1858.patch
- https://github.com/Kunstmaan/KunstmaanBundlesCMS/pull/1858.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1858>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ACrShLYNRMBwe1JvwYpk70X4L3y5bsS9ks5taCmdgaJpZM4SYp0M>
.
|
No problem, I've updated the PR to decode |
@mtnorthrop Thanks! This is quite an annoying bug, any chance of a quick merge and release? |
I hope this can be reviewed, merged and released soon, because in AdminBundle 5.0.4 all internal links and images added to the WYSIWYG fields are currently broken, and this PR fixes the issue. |
@mtnorthrop I've reviewed it and merged it now. We will create a new release tomorrow! |
@sandergo90 Thank you! |
@mtnorthrop new release submitted! |
The
MediaTokenTransformer::reverseTransform()
method uses theCrawler::html()
method to produce the HTML it returns, but this method automatically URL-encodes thesrc
attribute of image tags.This PR does a search and replace on the final HTML to make sure that the square brackets used for the tokens are preserved.
NB: the Symfony docs mention that the DomCrawler Component is not designed to re-dump HTML, and so it might be worth considering looking for a different tool to use in this class. (See https://symfony.com/doc/current/components/dom_crawler.html#component-dom-crawler-dumping).