Incorrect parsing when more than 10 URLs or E-mails exists

alienbrain - March 22, 2009 - 15:52
Project:Delicious
Version:6.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Hello,

In delicious.inc:_delicious_tag_string(), the code for protecting all URLs/Emails temporarily before parsing was creating weak tokens that could be easily confused later when replacing them back. Here is what happens:

The code protects all URLs/Emails by using temporary tokens for them, the tokens look like this:

__delicious_processing_replacement_1
__delicious_processing_replacement_2
....
<strong>__delicious_processing_replacement_1</strong>0
<strong>__delicious_processing_replacement_1</strong>1

If you notice, the first token (__delicious_processing_replacement_1) will mistakingly match also the last ones. So this currently happens when you have more then 10 URLs/Emails in the body of the node being processed with delicious.

Attached a simple patch which fixes this by using md5() to hash the URLs/Emails instead of the simple increment.

AttachmentSize
delicious_smarttag_replacements_md5.patch672 bytes

#1

alienbrain - March 22, 2009 - 15:52
Title:Uncorrect parsing when more than 10 URLs or E-mails exists» Incorrect parsing when more than 10 URLs or E-mails exists
 
 

Drupal is a registered trademark of Dries Buytaert.