MIME.pmod problems with parsing '\\'
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=1437
Reported by Peter Lundqvist, n/a peterl@update.uu.se
The MIME module seems to have problems with parsing '\' chars. This is a problem as win-browsers tend to send filenames as "N:\fjuk\moeg\junk.txt". This simple pike-script illustrates the problem:
--[fnyk.pike]------------------------------------------
#! /usr/local/bin/pike
void main() {
object msg = MIME.Message(
"MIME-Version: 1.0\r\nContent-type: "
"multipart/form-data;boundary=---------"
"------------------10338236936774\r\n\r\n" +
#"-----------------------------10338236936774
Content-Disposition: form-data; name=\"op\"
ul
-----------------------------10338236936774
Content-Disposition: form-data; name=\"foofile\";
filename=\"N:\\Program\\Fnyk\\index.txt\"
Content-Type: text/plain
Det var en kyckling som hette gullefjunk... -----------------------------10338236936774 Content-Disposition: form-data; name="fjuk"
Upload -----------------------------10338236936774--
-----------------------------10338236936774--");
int parts=sizeof( msg->body_parts );
for( int i=0; i<parts; i++ ) {
object o = msg->body_parts[i];
if( !zero_type( o->disp_params["filename"] ) )
write( o->get_filename()+"\n" );
}
}
--[EOF: fnyk.pike]-------------------------------------
# ./fnyk.pike
N:ProgramFnykindex.txt
#