fix: use correct spelling of attachment with Content-Disposition header (#29621)
This commit is contained in:
parent
f6d673c32a
commit
fed5ad5303
2 changed files with 4 additions and 4 deletions
|
@ -129,7 +129,7 @@ v8::Local<v8::Value> HttpResponseHeadersToV8(
|
|||
!value.empty()) {
|
||||
net::HttpContentDisposition header(value, std::string());
|
||||
std::string decodedFilename =
|
||||
header.is_attachment() ? " attachement" : " inline";
|
||||
header.is_attachment() ? " attachment" : " inline";
|
||||
decodedFilename += "; filename=" + header.filename();
|
||||
value = decodedFilename;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ describe('webRequest module', () => {
|
|||
res.setHeader('Location', 'http://' + req.rawHeaders[1]);
|
||||
res.end();
|
||||
} else if (req.url === '/contentDisposition') {
|
||||
res.setHeader('content-disposition', [' attachement; filename=aa%E4%B8%ADaa.txt']);
|
||||
res.setHeader('content-disposition', [' attachment; filename=aa%E4%B8%ADaa.txt']);
|
||||
const content = req.url;
|
||||
res.end(content);
|
||||
} else {
|
||||
|
@ -306,11 +306,11 @@ describe('webRequest module', () => {
|
|||
|
||||
it('does not change content-disposition header by default', async () => {
|
||||
ses.webRequest.onHeadersReceived((details, callback) => {
|
||||
expect(details.responseHeaders!['content-disposition']).to.deep.equal([' attachement; filename=aa中aa.txt']);
|
||||
expect(details.responseHeaders!['content-disposition']).to.deep.equal([' attachment; filename=aa中aa.txt']);
|
||||
callback({});
|
||||
});
|
||||
const { data, headers } = await ajax(defaultURL + 'contentDisposition');
|
||||
expect(headers).to.match(/^content-disposition: attachement; filename=aa%E4%B8%ADaa.txt$/m);
|
||||
expect(headers).to.match(/^content-disposition: attachment; filename=aa%E4%B8%ADaa.txt$/m);
|
||||
expect(data).to.equal('/contentDisposition');
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue