Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit ff7714d

Browse files
try to fix remote image hook
1 parent b6877fa commit ff7714d

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

server/hooks/save-remote-images.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ function createUploadDirIfNeeded () {
1717
}
1818
}
1919

20-
class SaveRemoveImage {
21-
constructor (hook) {
22-
this.hook = hook;
23-
}
24-
uploadBlob () {
25-
26-
}
27-
}
20+
// lass SaveRemoveImage {
21+
// constructor (hook) {
22+
// this.hook = hook;
23+
// }
24+
// uploadBlob () {
25+
//
26+
// }
27+
//
2828

2929
module.exports = function (options = []) { // eslint-disable-line no-unused-vars
3030
return function async (hook) {
@@ -53,7 +53,7 @@ module.exports = function (options = []) { // eslint-disable-line no-unused-vars
5353
// hook.app.debug(`cancel on invalid image url: ${hook.data[field]}`);
5454
// return;
5555
// }
56-
hook.app.debug(`###try to get image: ${hook.data[field]}`);
56+
// hook.app.debug(`###try to get image: ${hook.data[field]}`);
5757

5858
loading++;
5959
imgCount++;
@@ -82,22 +82,22 @@ module.exports = function (options = []) { // eslint-disable-line no-unused-vars
8282
reject(err);
8383
}
8484
} else if (validUrl.isUri(hook.data[field])) {
85-
hook.app.debug('SAVE REMOTE IMAGES HOOK');
86-
hook.app.debug(`###request url: ${hook.data[field]}`);
85+
// hook.app.debug('SAVE REMOTE IMAGES HOOK');
86+
// hook.app.debug(`###request url: ${hook.data[field]}`);
8787
request({
8888
url: hook.data[field],
8989
encoding: null,
90-
timeout: 15000
90+
timeout: 30000
9191
}, (err, res, body) => {
9292
if (err) {
9393
hook.app.error(err);
9494
reject(err);
9595
}
96-
hook.app.debug(`###got answer for: ${hook.data[field]}`);
96+
// hook.app.debug(`###got answer for: ${hook.data[field]}`);
9797
try {
9898
const mimeType = res.headers['content-type'];
9999
if (mimeType.indexOf('image') !== 0) {
100-
hook.app.log('~~~~~its not an image');
100+
// hook.app.log('~~~~~its not an image');
101101
reject('its not an image');
102102
}
103103

0 commit comments

Comments
 (0)