I have had some issues with the MailhandlerCommandsDefault.class.php file in plugins/mailhandler/commands.

I have been using the mailhandler plugin extensively to import a lot of varied data into Drupal. I found that where a command value contained a colon (':') after the command name, importing would not function correctly. In addition, I noticed a problem where forward slashes in the value were interpreted as part of the regex pattern used to strip all commands from the message body.

I have made a patch which addresses both of these problems. Firstly, instead of exploding command lines at the colon character, I implemented a regular expression match which returns only that text preceding the first colon. You will see from my comments that the pattern is not very fussy as I couldn't find any validation being performed when commands are added.

The problem with forward slashes is fixed by using str_replace instead of preg_match.

This is the first patch I've ever made, I hope it's okay and is of some use. Please let me know if anything is wrong and whether these changes might be considered for commit.

Thanks for the great module!

CommentFileSizeAuthor
fix-colons-in-values.patch2.07 KBwuh

Comments

danepowell’s picture

Title: Colons present in command strings after the command name break import » Colons in command strings after the command name break import
Status: Active » Fixed

Thanks for reporting- the issue regarding special characters in commands (forward slash) was fixed by #1409066: Error message due to taxonomy terms with special characters.

I fixed the issue regarding colons in command strings in 6.x and 7.x:
http://drupalcode.org/project/mailhandler.git/commit/d8e0c94
http://drupalcode.org/project/mailhandler.git/commit/8f0fe7a

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.