Skip to content

Commit

Permalink
fix: use correct spelling of attachment with Content-Disposition head…
Browse files Browse the repository at this point in the history
…er (#29621)
  • Loading branch information
dsanders11 committed Jun 14, 2021
1 parent f6d673c commit fed5ad5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion shell/browser/api/electron_api_web_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions spec-main/api-web-request-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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');
});

Expand Down

0 comments on commit fed5ad5

Please sign in to comment.