diff --git a/art/themes/luciano_blocktronics/activitypub_actor_search_main.ans b/art/themes/luciano_blocktronics/activitypub_actor_search_main.ans index 1f7a6074..81ad1562 100644 Binary files a/art/themes/luciano_blocktronics/activitypub_actor_search_main.ans and b/art/themes/luciano_blocktronics/activitypub_actor_search_main.ans differ diff --git a/core/http_util.js b/core/http_util.js index 98f8936b..a1469c2d 100644 --- a/core/http_util.js +++ b/core/http_util.js @@ -70,6 +70,14 @@ function _makeRequest(url, options, cb) { } } + let cbCalled = false; + const cbWrapper = (e, b, r) => { + if (!cbCalled) { + cbCalled = true; + return cb(e, b, r); + } + }; + const req = https.request(url, options, res => { let body = []; res.on('data', d => { @@ -80,7 +88,7 @@ function _makeRequest(url, options, cb) { body = Buffer.concat(body).toString(); if (res.statusCode < 200 || res.statusCode > 299) { - return cb( + return cbWrapper( Errors.HttpError( `URL ${url} HTTP error ${res.statusCode}: ${truncate(body, { length: 128, @@ -89,7 +97,7 @@ function _makeRequest(url, options, cb) { ); } - return cb(null, body, res); + return cbWrapper(null, body, res); }); }); @@ -98,17 +106,17 @@ function _makeRequest(url, options, cb) { httpSignature.sign(req, options.sign); } catch (e) { req.destroy(); - return cb(Errors.Invalid(`Invalid signing material: ${e}`)); + return cbWrapper(Errors.Invalid(`Invalid signing material: ${e}`)); } } req.on('error', err => { - return cb(err); + return cbWrapper(err); }); req.on('timeout', () => { req.destroy(); - return cb(Errors.Timeout('Timeout making HTTP request')); + return cbWrapper(Errors.Timeout('Timeout making HTTP request')); }); if (options.body) {