To reproduce;

1) create a text field on a node type
2) set the node type to use that field's token in an automatically generated title
3) create a node where that field's value is something similar to testin' is fun
4) see the node's title created as testin' is fun

Comments

Robin Monks’s picture

This is a patch that has not been extensively tested for security and should not be used in situations where the users creating nodes are not trusted. No, it's not a proper git patch because I want you to think long and hard before applying it, so it's supposed to be hard.

Index: auto_nodetitle.module
===================================================================
--- auto_nodetitle.module	(revision 233)
+++ auto_nodetitle.module	(working copy)
@@ -86,6 +86,7 @@
   }
   // Ensure the generated title isn't too long.
   $node->title = substr($node->title, 0, 255);
+  $node->title = decode_entities($node->title);
   // With that flag we ensure we don't apply the title two times to the same
   // node. See auto_nodetitle_is_needed().
   $node->auto_nodetitle_applied = TRUE;

Feel free to check into the security of this solution and roll a proper patch. At the very least I suspect a check_plain or xss check needs to happen, but I'm not currently willing to dig into node_save enough to figure out which combo.

/Robin

Andrew_Mallis’s picture

micahw156’s picture

Status: Active » Closed (duplicate)
codesidekick’s picture

I just ran into this problem when using node fields in the titles.

To avoid this happening (without patching or anything) use the field token rather then the value token.

eg use

[field-my-great-field]

instead of

[field_my_great_field]

afmdsouza’s picture

Issue summary: View changes

Workaround provided at #4 works - thanks.

Obliveon’s picture

#4 worked for me but i had to install Entity Tokens... without it the field tokens don't show