[gmime-devel] bug in mime generation with specific filename



Hey all,

Without further ado, here's a code snippet to reproduce the bug:

<code>
void print_mime(GMimeMessage *m)
{
    GMimeStream *stdout_stream = g_mime_stream_fs_new(0);
    g_mime_object_write_to_stream((GMimeObject *)m, stdout_stream);
}

int main(int argc, char **argv)
{
    g_mime_init(0);

    const char *filename = "Ferry Corsten - Corsten's Countdown
171-200 (nic nie brakuje).odt";

    GMimeMessage *m = g_mime_message_new(0);
    GMimePart    *p = g_mime_part_new();

    g_mime_part_set_filename(p, filename);
    g_mime_message_set_mime_part(m, (GMimeObject *)p);

    print_mime(m);

    return 0;
}
</code>

I've tried this on 2.4 and 2.6, and this is the MIME it produces:

<mime>
MIME-Version: 1.0
Content-Type: text/plain; name=
Content-Disposition: attachment; filename=odt
</mime>

As you see, the filename get truncated.

I've tried debugging it, but only got as far as param_list_format(),
It's called 4 times and if I print the 'out' GString, I see that the
first two times, the output seems fine:

out: Content-Disposition: attachment; filename*0="Ferry Corsten -
Corsten's Countdown 171-200 (nic nie brakuje)."; filename*1="odt"
out: Content-Type: text/plain; name*0="Ferry Corsten - Corsten's
Countdown 171-200 (nic nie brakuje).odt"

but the next two times, it's broken:

out: Content-Type: text/plain; name=
out: Content-Disposition: attachment; filename=odt

I hope this helps somehow,  I wanted to hear your opinion before
debugging further.

Thanks!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]