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.

Files: 
CommentFileSizeAuthor
#10 1828580-media-double-brackets-10.patch1.08 KBlongwave
PASSED: [[SimpleTest]]: [MySQL] 1,094 pass(es).
[ View ]

Comments

ankur’s picture

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

Here's a patch that changes the function media_token_to_markup(), defined in includes/media.filter.inc, 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 ?

_

longwave’s picture

Status:Active» Needs review
StatusFileSize
new1.05 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1828580-media-double-brackets.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

I am running into this problem with some chemical names embedded in my content. As an example I have [[2,2'-[ethylenebis(nitrilomethylidyne)]bis[6-fluorophenolato]]-N,N',O,O']cobalt in a node body and the first part of this is being cut off by the media filter. The patch in #1 worked for me though the files have moved so I am attaching a new patch.

I don't see how it's possible to distinguish between content such as my example and an invalid media tag; I think the filter should just leave unhandled tags alone.

Status:Needs review» Needs work

The last submitted patch, 8: 1828580-media-double-brackets.patch, failed testing.

longwave’s picture

Status:Needs work» Needs review
StatusFileSize
new1.08 KB
PASSED: [[SimpleTest]]: [MySQL] 1,094 pass(es).
[ View ]

Oops, not running latest -dev on my site. Let's try that again.