[interchange-bugs] [rt.icdevgroup.org #268] [Comment] File.pm regression: binary uploads getting corrupted

Stefan Hornburg via RT interchange-comment at rt.icdevgroup.org
Tue Nov 10 21:45:24 UTC 2009


http://rt.icdevgroup.org/Ticket/Display.html?id=268
This is a comment.  It is not sent to the Requestor(s):

Vend::Server::parse_multipart is responsible for storing the browser input in $CGI::file (see code snippet below). 

It doesn't take into account where the catalog itself runs in UTF-8 mode.

It doesn't pass information about the encoding along with the file
contents, we thought about using $CGI::file_encoding variable.

Maybe we should leave the file alone and do the conversion when we
enter the catalog.

			my ($content_type) = $header{'Content-Type'} =~ /^([^\s;]+)/;
			my ($charset) = $header{'Content-Type'} =~ / charset="?([-a-zA-Z0-9]+)"?/;

			$content_type ||= 'text/plain';
			$charset ||= default_charset();

			if ($content_type =~ m{^text/}i) {
				$charset and $Global::UTF8 and Vend::CharSet::to_internal($charset, \$data);
			}

			if($filename) {
				$CGI::file{$param} = $data;
				$data = $filename;
			}
			else {
				$data =~ s/\r?\n$//;
			}
			store_cgi_kv($param, $data);

Regards
          Racke



More information about the interchange-bugs mailing list