Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ContentType not correctly parsed #25

Open
JanC opened this Issue · 2 comments

2 participants

@JanC

Hi,
it looks like the Content-Type header line is parsed only by the "main" type (e.g. "text") and "subtype" (e.g. "plain") but not the rest.

CTCoreMessage *msg = [[CTCoreMessage alloc] initWithString:@"Subject: MySubject\n"
            "Content-Type: text/plain; charset=us-ascii"];
msg.fetchBodyStructure;

NSLog(@"ContentType: %@", [(CTMIME_TextPart*)msg.mime.content contentType]);

The resulting Content-Type is "text/plain" and the charset is dropped.

@JanC

The entire header itself is not parsed. If I supply a text/html type, it is parsed as text/plain:

CTCoreMessage *msg = [[CTCoreMessage alloc] initWithString:@"Subject: MySubject\n"
            "Content-Type: text/html; charset=us-ascii"];
msg.fetchBodyStructure;
NSLog(@"ContentType: %@", [(CTMIME_TextPart*)msg.mime.content contentType]);

output is

ContentType: text/plain
@omolowa

As far as I can see in the code, the CTMIME_TextPart class is statically creating a text/plain instance. Could you try it with a

NSLog(@"ContentType: %@", [(CTMIME*)msg.mime.content contentType]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.