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