mirror of
https://github.com/zotero/zotero.git
synced 2026-09-13 23:11:13 +00:00
HTTP.download(): Don't save file for non-2xx response
This commit is contained in:
parent
cc0b1ad0c9
commit
a370ec8979
1 changed files with 8 additions and 2 deletions
|
|
@ -677,8 +677,14 @@ Zotero.HTTP = new function() {
|
|||
noMock: true
|
||||
}
|
||||
);
|
||||
var bytes = await IOUtils.write(path, await req.response.bytes());
|
||||
Zotero.debug(`Saved file to ${path} (${bytes} byte${bytes != 1 ? 's' : ''})`);
|
||||
if (req.status >= 200 && req.status < 300) {
|
||||
var bytes = await IOUtils.write(path, await req.response.bytes());
|
||||
Zotero.debug(`Saved file to ${path} (${bytes} byte${bytes != 1 ? 's' : ''})`);
|
||||
}
|
||||
// Only relevant if status is in successCodes
|
||||
else {
|
||||
Zotero.debug("Not saving file for non-2xx response code");
|
||||
}
|
||||
return req;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue