Comments

jim0203’s picture

Issue tags: +#d7ux

With regards to the dsm() bug, this can be fixed by changing line 512 of shortcut.admin.inc from

drupal_set_message(t('Added a shortcut for %title.', array('%title' => $link['link_title'])));

to

drupal_set_message(t('Added a shortcut for !title.', array('!title' => $link['link_title'])));

This makes t() pass through $link['link_title'] rather than running check_plain() on it. But I'm not sure if this is a good thing to do with regards to security.

I can't track down the code which escapes the tags in the menu itself - if anyone could tell me where it is I'd be grateful, as I've spent far too much time looking for it =). In any event, what is happening here is more or less expected behaviour from the menu system: if you feed it an entry which has HTML tags in its title, it will escape those tags when it displays the entry. I'm guessing what we should do here, then, is to strip the tags from the link title before adding it into the menu system, but I'd appreciate other thoughts on what is partly a UX issue.

webchick’s picture

Just confirming that this is still an issue. I'm not sure what to tell you on your menu questions, but maybe bumping this issue will cause someone smarter than me to take a look. :)

janusman’s picture

StatusFileSize
new1.82 KB

Confirming this is still present in alpha1.
2010-01-15_095924.png

stborchert’s picture

Title: <em> tag is escaped when adding shortcuts » html tags are escaped when adding shortcuts
Status: Active » Needs review
Issue tags: +Usability, +D7UX
StatusFileSize
new631 bytes
new170.69 KB
new156.72 KB
new171.17 KB
new172.45 KB
new158.3 KB
new174.95 KB

Simply filtering all html tags from the page title while creating results in clean shortcut names.
See screenshots for behavior before and after this patch.

deviantintegral’s picture

Status: Needs review » Needs work

Why is a title being saved that contains an emphasis tag in the first place? This seems like it just covers up the original problem.

stborchert’s picture

Uhm, if you apply the patch the html is stripped from the title and isn't saved.

deviantintegral’s picture

What I mean is, somewhere the title is being set with drupal_set_title() with the emphasis tags included. Wouldn't that be a better place to fix this?

stborchert’s picture

Hm. Using HTML in titles is a feature imo.
If you look at block.module (especially block_admin_configure it is used to emphase the block name within the page title (and highlight it this way).

Don't know if its a bad idea at all. I like the possibility to do it :).

deviantintegral’s picture

Status: Needs work » Reviewed & tested by the community

I forgot that the function is for both the title in the viewport and the title tag of the page; thanks for the reminder. I thought then about how it should be solved, and came up with the same solution :).

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs review

I think the patch at #705250: Remove HTML markup from Shortcuts (which I just marked as duplicate of this issue) at first glance seems like a better approach.... Why not do this in the menu callback that is actually used to save the link?

Cibes’s picture

StatusFileSize
new770 bytes

I got a new patch adapted to the latest HEAD solving the issue as in #705250: Remove HTML markup from Shortcuts by striping html not when displaying but rather when creating the shortcuts.

Unfortunately I can not reproduce the bug - can anyone give step by step instructions? (The "Management block" used above gives a shortcut named "Configure block" without any html for me.)

janusman’s picture

Status: Needs review » Reviewed & tested by the community

In february there's a commit where the shortcut title is auto-generated from the menu item for that path. Now it could only be reproduced if there was some markup there, or if there is no menu item for that link.

Seems fine to me!

aspilicious’s picture

#11: 607348_html_in_shortcuts.patch queued for re-testing.

aspilicious’s picture

*Retesting old patches*

sun’s picture

Status: Reviewed & tested by the community » Needs work
+++ modules/shortcut/shortcut.admin.inc	19 May 2010 11:06:30 -0000
@@ -701,7 +701,7 @@ function shortcut_link_add_inline($short
-      'link_title' => $title,
+      'link_title' => strip_tags($title),

Usage of strip_tags() is fairly uncommon in Drupal. What we need here is a solid inline comment that explains why strip_tags() is required here.

For example, next to the actual cause for strip_tags(), the code should provide reasoning for as to why it does not set 'html' => TRUE instead.

Powered by Dreditor.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.