The title should say it all. I'm in a situation where the content includes double-bracketed expressions (e.g., "[[something like this]]") that are not intended as file or image references.

However, the media module picks up these double-bracketed expressions, interprets them as buggy image references, and removes them altogether from the output. This might be related to #1070708: Validate Media Markup in Content, except that this bug concerns how the media filter processes these expressions on the server side rather than how the javascript translates them on the WYSIWYG editing interface.

I'm wondering if we might be able to return the original input rather than the empty string when one of these double-bracketed expressions is encountered.

#1 media-preserve-double-brackets-1828580-1.patch873 bytesankur
PASSED: [[SimpleTest]]: [MySQL] 5 pass(es).
[ View ]


ankur’s picture

new873 bytes
PASSED: [[SimpleTest]]: [MySQL] 5 pass(es).
[ View ]

Here's a patch that changes the function media_token_to_markup(), defined in includes/, to return the original bracketed expression if it could not be converted into a file or image reference.

ankur’s picture

Status:Active» Needs review
ParisLiakos’s picture

Status:Needs review» Needs work

hmm, but then the media_tokens that fail rendering would appear as is? that would be bad...users seeing a json string in the middle of the body text would be not desirable.
maybe the best approach here would be to provide a media_tag_pre_render hook there? so lets say markdown converts this tag first if needed.

Did you try giving markdown filter higher presedence in text formats admin screen btw?
so markdown runs first and media then...or markdown try to convert and destroy media tags as well?

Dave Reid’s picture

Status:Needs work» Closed (duplicate)

I think this should be marked as a duplicate of #1314266: Replace media tag in wysiwyg only if the type equals to "media"

siefca’s picture

I'm not using any WYSIWYG editor, just pure-text BUEditor, and also having this problem. The brackets are removed in PHP code, by filter.

gimpel’s picture

Status:Closed (duplicate)» Active

Same issue here when trying to blog something that uses BASH if tests with double brackets.
Thanks a lot for the patch! That fixed it here.

The patch is still applying fine against alpha2 with some hunks and fixes the issue.
Reopening this one because the other report got closed due to something like a brain fart (sorry).

thisisjusthowidoit’s picture

Issue summary:View changes

I ran across the same issue as 'gimpel' and the patch in this ticket fix it for me.

Will this patch work its way into the next Media release ?