@@ -123,7 +123,8 @@ async function pushToQueue(task, cb) {
123
123
const node = await processRemoteNode ( task )
124
124
return cb ( null , node )
125
125
} catch ( e ) {
126
- return cb ( null , e )
126
+ console . warn ( `Failed to process remote content ${ task . url } ` )
127
+ return cb ( e )
127
128
}
128
129
}
129
130
@@ -222,47 +223,38 @@ async function processRemoteNode({
222
223
const tmpFilename = createFilePath ( pluginCacheDir , `tmp-${ digest } ` , ext )
223
224
224
225
// Fetch the file.
225
- try {
226
- const response = await requestRemoteNode ( url , headers , tmpFilename )
227
- // Save the response headers for future requests.
228
- await cache . set ( cacheId ( url ) , response . headers )
229
-
230
- // If the user did not provide an extension and we couldn't get one from remote file, try and guess one
231
- if ( ext === `` ) {
232
- const buffer = readChunk . sync ( tmpFilename , 0 , fileType . minimumBytes )
233
- const filetype = fileType ( buffer )
234
- if ( filetype ) {
235
- ext = `.${ filetype . ext } `
236
- }
237
- }
238
-
239
- const filename = createFilePath (
240
- path . join ( pluginCacheDir , digest ) ,
241
- name ,
242
- ext
243
- )
244
- // If the status code is 200, move the piped temp file to the real name.
245
- if ( response . statusCode === 200 ) {
246
- await fs . move ( tmpFilename , filename , { overwrite : true } )
247
- // Else if 304, remove the empty response.
248
- } else {
249
- await fs . remove ( tmpFilename )
226
+ const response = await requestRemoteNode ( url , headers , tmpFilename )
227
+ // Save the response headers for future requests.
228
+ await cache . set ( cacheId ( url ) , response . headers )
229
+
230
+ // If the user did not provide an extension and we couldn't get one from remote file, try and guess one
231
+ if ( ext === `` ) {
232
+ const buffer = readChunk . sync ( tmpFilename , 0 , fileType . minimumBytes )
233
+ const filetype = fileType ( buffer )
234
+ if ( filetype ) {
235
+ ext = `.${ filetype . ext } `
250
236
}
237
+ }
251
238
252
- // Create the file node.
253
- const fileNode = await createFileNode ( filename , createNodeId , { } )
254
- fileNode . internal . description = `File "${ url } "`
255
- // Override the default plugin as gatsby-source-filesystem needs to
256
- // be the owner of File nodes or there'll be conflicts if any other
257
- // File nodes are created through normal usages of
258
- // gatsby-source-filesystem.
259
- createNode ( fileNode , { name : `gatsby-source-filesystem` } )
260
-
261
- return fileNode
262
- } catch ( err ) {
263
- // ignore
239
+ const filename = createFilePath ( path . join ( pluginCacheDir , digest ) , name , ext )
240
+ // If the status code is 200, move the piped temp file to the real name.
241
+ if ( response . statusCode === 200 ) {
242
+ await fs . move ( tmpFilename , filename , { overwrite : true } )
243
+ // Else if 304, remove the empty response.
244
+ } else {
245
+ await fs . remove ( tmpFilename )
264
246
}
265
- return null
247
+
248
+ // Create the file node.
249
+ const fileNode = await createFileNode ( filename , createNodeId , { } )
250
+ fileNode . internal . description = `File "${ url } "`
251
+ // Override the default plugin as gatsby-source-filesystem needs to
252
+ // be the owner of File nodes or there'll be conflicts if any other
253
+ // File nodes are created through normal usages of
254
+ // gatsby-source-filesystem.
255
+ createNode ( fileNode , { name : `gatsby-source-filesystem` } )
256
+
257
+ return fileNode
266
258
}
267
259
268
260
/**
0 commit comments