Re: [PATCH] gitweb: Convert Content-Disposition filenames into qtext
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Oct 7, 2006, 10:06 UTC
- Message-ID
- <eg7u5n$mt9$1@sea.gmane.org>
- In-Reply-To
- <7vk63ctq47.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
Show 8 quoted lines
> Luben Tuikov <ltuikov@yahoo.com> writes:
>
>>>> +# Convert a string (e.g. a filename) into qtext as defined
>>>> +# in RFC 822, from RFC 2183. To be used by Content-Disposition.
>>>> +sub to_qtext {
>>>> + my $str = shift;
>>>> + $str =~ s/\\/\\\\/g;
>>>> + $str =~ s/\"/\\\"/g;Here probably it could be
$str =~ s/"/\\"/g;Show 7 quoted lines
>>>> + $str =~ s/\r/\\r/g; >>> >>> \r? Not \n? >> >> Yes, \r, not \n. > > \r to \\r? Not to \\\r?
We want "\r" in suggested filename, not "\ " I think, so it is "\\r".
Otherwise we could use simplier
$str =~ s/([\\"\r])/\\\1/g;-- Jakub Narebski Warsaw, Poland ShadeHawk on #git