This repository was archived by the owner on Jun 27, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -97,8 +97,8 @@ module.exports = function (options = []) { // eslint-disable-line no-unused-vars
97
97
try {
98
98
const mimeType = res . headers [ 'content-type' ] ;
99
99
if ( mimeType . indexOf ( 'image' ) !== 0 ) {
100
- // hook.app.log('~~~~~ its not an image');
101
- reject ( 'its not an image' ) ;
100
+ hook . app . error ( ' its not an image') ;
101
+ reject ( new Error ( 'its not an image' ) ) ;
102
102
}
103
103
104
104
const ext = mime . getExtension ( mimeType ) ;
@@ -116,9 +116,12 @@ module.exports = function (options = []) { // eslint-disable-line no-unused-vars
116
116
if ( imgCount > 0 && loading <= 0 ) {
117
117
hook . app . debug ( 'Download(s) finished' , urls ) ;
118
118
resolve ( hook ) ;
119
+ } else if ( ! imgCount ) {
120
+ resolve ( hook ) ;
119
121
}
120
122
} catch ( err ) {
121
123
hook . app . error ( err ) ;
124
+ reject ( err ) ;
122
125
}
123
126
} ) ;
124
127
} else {
@@ -131,7 +134,7 @@ module.exports = function (options = []) { // eslint-disable-line no-unused-vars
131
134
if ( imgCount > 0 && loading <= 0 ) {
132
135
hook . app . debug ( 'Download(s) finished' , urls ) ;
133
136
resolve ( hook ) ;
134
- } else if ( imgCount <= 0 ) {
137
+ } else if ( ! imgCount ) {
135
138
resolve ( hook ) ;
136
139
}
137
140
} catch ( err ) {
You can’t perform that action at this time.
0 commit comments