Opened 7 years ago
Closed 6 years ago
#44278 closed defect (bug) (duplicate)
Smileys got rendered inside pre/code tags in case html attributes are added to the tag
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Formatting | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
hi!
in case "raw" content is posted in a pre tag, legacy smiley sequences are processed by the convert_smilies function and converted to images, even if the html tags are in the $tags_to_ignore list.
this is caused by a weak regex inside the function which didn't take care of html attributes
example content to reproduce the issue
hello :) this is sourcecode and should not contain smiley images: <pre class="EnlighterJSRAW" data-enlighter-language="js">alert(':)'); // :)</pre> and text :(
attached a fixed version which is taking care of additional html attributes
best regards, Andi
Attachments (3)
Change History (8)
#1
@
7 years ago
- Keywords needs-unit-tests added
- Version trunk deleted
Thanks for the ticket and patch @Andi Dittrich
There is already ticket #16448 that is marked as fixed, so did something change since then?
#2
@
7 years ago
the old ticket adds the generic functionality to exclude pre/code tags from convert_smilies.
but it uses a weak regex which didn't handle html attributes on these tags.
this patch fixes the feature introduced in #16448 by modifying the regex
#3
@
6 years ago
- Keywords has-unit-tests added; needs-unit-tests removed
The patch in 44278.3.diff includes some suggestions:
- Adds a unit test for ignored tags with attributes.
- Uses
[^>]*
instead of.*
with the non-greedy modifierU
. It feels somewhat more transparent to me.
Additionally it uses the opportunity to:
- Add full-stops to inline comments.
- Capitalize inline comments.
- Fix a typo in inline comment: From
proessing
toprocessing
. - Format inline description.
in convert_smilies()
.
patch to fix the regex