mirror of
https://github.com/zadam/trilium.git
synced 2025-01-15 19:51:57 +08:00
fix enforcing node's http requests for sync
This commit is contained in:
parent
00faf758e8
commit
85d986534d
1 changed files with 4 additions and 1 deletions
|
@ -9,12 +9,13 @@ const syncOptions = require('./sync_options');
|
|||
// this allows to support system proxy
|
||||
|
||||
function exec(opts) {
|
||||
const client = getClient(opts);
|
||||
|
||||
// hack for cases where electron.net does not work but we don't want to set proxy
|
||||
if (opts.proxy === 'noproxy') {
|
||||
opts.proxy = null;
|
||||
}
|
||||
|
||||
const client = getClient(opts);
|
||||
const proxyAgent = getProxyAgent(opts);
|
||||
const parsedTargetUrl = url.parse(opts.url);
|
||||
|
||||
|
@ -111,6 +112,8 @@ async function getImage(imageUrl) {
|
|||
|
||||
request.on('error', err => reject(generateError(opts, err)));
|
||||
|
||||
request.on('abort', err => reject(generateError(opts, err)));
|
||||
|
||||
request.on('response', response => {
|
||||
if (![200, 201, 204].includes(response.statusCode)) {
|
||||
reject(generateError(opts, response.statusCode + ' ' + response.statusMessage));
|
||||
|
|
Loading…
Reference in a new issue