fix: incorrect Content-Disposition serialization (#31669)

* fix: incorrect Content-Disposition serialization

* test: fixup test
This commit is contained in:
Shelley Vohr 2021-11-03 15:11:37 +01:00 committed by GitHub
parent 31e877515c
commit 24b02d68a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -133,8 +133,10 @@ v8::Local<v8::Value> HttpResponseHeadersToV8(
net::HttpContentDisposition header(value, std::string());
std::string decodedFilename =
header.is_attachment() ? " attachment" : " inline";
decodedFilename += "; filename=" + header.filename();
value = decodedFilename;
// The filename must be encased in double quotes for serialization
// to happen correctly.
std::string filename = "\"" + header.filename() + "\"";
value = decodedFilename + "; filename=" + filename;
}
if (!values)
values = response_headers.SetKey(key, base::ListValue());