flag_create_link generates bad HTML
nateprouty - February 24, 2009 - 17:20
| Project: | Flag |
| Version: | 6.x-1.0-rc1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
On the /admin/build/flags/edit/ page, if I use quotes in any of the description fields that are then added as part of the tag that is generated via the flag_create_link() function, the tag is output incorrectly (doesn't escape the quotes)
For example:
flag_create_link('watchlist', $nid) ---> <a class="flag flag-action flag-link-toggle flag-processed" list="" watch="" your="" to="" 93)="" (id:="" project="" new="" my="" title="Add the project " href="/flag/flag/watchlist/93?destination=projects&token=xx">Flag</a>Removing the quotes fixes it:
flag_create_link('watchlist', $nid) ---> <a class="flag flag-action flag-link-toggle flag-processed" title="Add the project My New Project to your watch list" href="/flag/flag/watchlist/93?destination=projects&token=xx">Flag</a>
#1
#2
#3
Obviously that description and example is wrong, forgot it would automatically convert my links...
Here's the description, again:
On the /admin/build/flags/edit/ page, if I use quotes in any of the description fields that are then added as part of the <a> tag that is generated via the flag_create_link() function, the <a> tag is output incorrectly (doesn't escape the quotes)
For example:
flag_create_link('watchlist', $nid) ---> <a class="flag flag-action flag-link-toggle flag-processed" list="" watch="" your="" to="" project="" new="" my="" title="Add the project " href="/flag/flag/watchlist/93?destination=projects&token=xx" rel="nofollow">Flag</a>
Removing the quotes fixes it:
flag_create_link('watchlist', $nid) ---> <a class="flag flag-action flag-link-toggle flag-processed" title="Add the project My New Project to your watch list" href="/flag/flag/watchlist/93?destination=projects&token=xx" rel="nofollow">Flag</a>
#4
Could you try out this patch and see if it causes any unexpected side-effects? Seems like this should do the trick.
#5
I committed the above patch.
#6
Automatically closed -- issue fixed for 2 weeks with no activity.