[rt-users] rt_client ruby: Issue with attachments in a multipart email

Thierry Thelliez thierry.thelliez.tech at gmail.com
Fri Jan 7 12:37:40 EST 2011


Tom,

Yesterday I encountered another similar issue.

Looking at the code, I see that the attachments parsing (in
rt_client0.3.7) relies on a pattern assuming '),' as a separator.

client.rb line 608:
     pattern = /(\d+:\s.*?\)),/

But one of ours users uploaded a file with '),' in the file name...

Also the above pattern skips the last attachment in the list.
Although I think that this is always an 'unnamed' one. One of the
problems is that the TMail::Mail.parse scraps the line breaks. So this
makes it difficult to write a reliable regular expression. So ideally
the code should be reorganized to parse 'resp' without the TMail
parsing, I think.

For this morning, I just made the regular expression a lot less likely
to hit a false positive:

    pattern = /\d+:\s+.*?\s+\(.*?\/.*?\s+\/\s+.*?[bkm]\)(,\s|$)/

Not perfect, but better for now.

(BTW, above I try to match a 'b' or a 'k', I am assuming that an 'm'
could happen, not sure)

Thierry Thelliez



On Tue, Oct 26, 2010 at 3:59 PM, Thierry Thelliez
<thierry.thelliez.tech at gmail.com> wrote:
> Tom,
>
> Thanks you so much. I was finally getting to it when I saw your email.
>  I tried your fix and it works for me.  More testing later.
>
>
> Thierry
>



More information about the rt-users mailing list