Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse error when an attachment has unicode file name #86

Closed
chotiwat opened this issue Aug 27, 2012 · 4 comments
Closed

Parse error when an attachment has unicode file name #86

chotiwat opened this issue Aug 27, 2012 · 4 comments

Comments

@chotiwat
Copy link
Contributor

If a message has an attachment with unicode file name, the module will throw an error when fetching message structure. This is because the file name will have its length specified inside curly brackets like this

... ("ATTACHMENT" ("FILENAME*" {326}\r\nutf-8\'\'%E0%B8%9B%E0%B8%A3%E0%B8%B0 ...

which the REGEXP_FETCH pattern will match incorrectly.

Below is the debug log:

CLIENT: A7 UID FETCH 11 (UID FLAGS INTERNALDATE BODYSTRUCTURE)


SERVER: '* 11 FETCH (FLAGS (\\Seen) UID 11 INTERNALDATE "27-Aug-2012 07:58:08 +0000" BODYSTRUCTURE (("TEXT" "PLAIN" ("CHARSET" "us-ascii") NIL NIL "7BIT" 1629 96 NIL NIL NIL NIL)(("TEXT" "HTML" ("CHARSET" "us-ascii") NIL NIL "QUOTED-PRINTABLE" 1939 29 NIL NIL NIL NIL)("APPLICATION" "OCTET-STREAM" ("X-UNIX-MODE" "0644" "NAME" "=?utf-8?B?4Lib4Lij4Liw4LiB4Liy4LioLi4u4LmB4LiI4LmJ4LiH4LiU4Lix?= =?utf-8?B?4Lia4LmE4Lif4Lif4LmJ4LiyICDguKfguLHguJnguK3guLI=?= =?utf-8?B?4LiX4Li04LiV4Lii4LmM4LiX4Li14LmIIDEyIOC4geC4ni4ubWJz?=") NIL NIL "QUOTED-PRINTABLE" 339241 NIL ("ATTACHMENT" ("FILENAME*" {326}\r\nutf-8\'\'%E0%B8%9B%E0%B8%A3%E0%B8%B0%E0%B8%81%E0%B8%B2%E0%B8%A8...%E0%B9%81%E0%B8%88%E0%B9%89%E0%B8%87%E0%B8%94%E0%B8%B1%E0%B8%9A%E0%B9%84%E0%B8%9F%E0%B8%9F%E0%B9%89%E0%B8%B2%20%20%E0%B8%A7%E0%B8%B1%E0%B8%99%E0%B8%AD%E0%B8%B2%E0%B8%97%E0%B8%B4%E0%B8%95%E0%B8%A2%E0%B9%8C%E0%B8%97%E0%B8%B5%E0%B9%88%2012%20%E0%B8%81%E0%B8%9E..mbs)) NIL NIL)("TEXT" "HTML" ("CHARSET" "us-ascii") NIL NIL "QUOTED-PRINTABLE" 5278 83 NIL NIL NIL NIL)("IMAGE" "PNG" ("NAME" "Mail Attachment.png") NIL NIL "BASE64" 1240 NIL ("INLINE" ("FILENAME" "Mail Attachment.png")) NIL NIL)("TEXT" "HTML" ("CHARSET" "us-ascii") NIL NIL "QUOTED-PRINTABLE" 1407 23 NIL NIL NIL NIL)("IMAGE" "PNG" ("NAME" "Mail Attachment.png") NIL NIL "BASE64" 97296 NIL ("INLINE" ("FILENAME" "Mail Attachment.png")) NIL NIL)("TEXT" "HTML" ("CHARSET" "us-ascii") NIL NIL "QUOTED-PRINTABLE" 1985 31 NIL NIL NIL NIL)("MESSAG'


/Users/top/wavify/node-imap/lib/imap.js:248
      type = type[1];
                 ^
TypeError: Cannot read property '1' of null
    at Socket.<anonymous> (/Users/top/wavify/node-imap/lib/imap.js:248:18)
    at Socket.emit (events.js:67:17)
    at TCP.onread (net.js:367:14)
@mscdex
Copy link
Owner

mscdex commented Aug 27, 2012

Yep, a real parser is needed, which I am still working on.

@chotiwat
Copy link
Contributor Author

I'm really looking forward to it. :)

@mscdex
Copy link
Owner

mscdex commented Sep 5, 2012

This should be fixed now...

@mscdex mscdex closed this as completed Sep 5, 2012
@chotiwat
Copy link
Contributor Author

chotiwat commented Sep 6, 2012

Yeah, it is.

Jivings added a commit to squarecat/node-imap that referenced this issue Nov 6, 2019
…g-credits

fix(socket): skip buffer for sending credits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants