Re: [Cppcms-users] Problem with http::file and the returned file name
Brought to you by:
artyom-beilis
|
From: Christian G. <chr...@gm...> - 2013-07-05 09:53:25
|
Hi all.
> In my web application I make use of a file uploader, which works like
> a charm. But
> I run into this problem:
>
> Some older IE versions (6,7,8) are sending the full path of the uploaded file
> in the multipart data - verified via wireshark.
> All other browsers (chrome, ff, safari) are sending only the filename.
>
> This looks like:
>
> Jul 5 10:24:51 chgm-pc tssw: Upload: request POST: id 'upload' (upload.cpp:21)
> Jul 5 10:24:51 chgm-pc tssw: upload: storing file C:Dokumente und
> EinstellungengmeinerEigene DateienDownloads01_257782.pdf - size:
> 2947635 (upload.cpp:41)
> Jul 5 10:24:51 chgm-pc tssw: upload:
> /tmp/If37354f45a5f672658789c3a33e95e68/C:Dokumente und
> EinstellungengmeinerEigene DateienDownloads01_257782.pdf
> (upload.cpp:48)
>
> I thought that I could filter out the substring starting from the last
> \ in the filename, but cppcms filters away all \.
> Is there a way to configure it or did I found a bug?
>
> The file looks in wireshark like:
> C:\Dokumente und Einstellungen\gmeiner\Eigene Dateien\Download\s01_257782.pdf
>
Sooo I found the problem in cppcms-1.0.4/private/http_protocol.h:
template<typename It>
std::string unquote(It &begin,It end)
{
It p=begin;
std::string result;
if(p>=end || *p!='\"')
return result;
result.reserve(end-p);
p++;
while(p < end) {
char c=*p++;
if(c=='\"') {
begin=p;
return result;
}
else if(c=='\\' && p<end) <--
result+= *p++; <--
else
result+=c;
}
result.clear();
return result;
}
If I comment out the else if everything works.
How shall I proceed? Send a patch?
--
Christian Gmeiner, MSc
|