Przeglądaj źródła

don't error if a http resource can not be download

try and continue, log the error but you might still be able to
compile. prevents issue with badly uploaded images in filstore
Henry Oswald 11 lat temu
rodzic
commit
4b3aa933a3
1 zmienionych plików z 5 dodań i 7 usunięć
  1. 5 7
      services/clsi/app/coffee/ResourceWriter.coffee

+ 5 - 7
services/clsi/app/coffee/ResourceWriter.coffee

@@ -5,6 +5,7 @@ async = require "async"
 mkdirp = require "mkdirp"
 OutputFileFinder = require "./OutputFileFinder"
 Metrics = require "./Metrics"
+logger = require "logger-sharelatex"
 
 module.exports = ResourceWriter =
 	syncResourcesToDisk: (project_id, resources, basePath, callback = (error) ->) ->
@@ -55,13 +56,10 @@ module.exports = ResourceWriter =
 			return callback(error) if error?
 			# TODO: Don't overwrite file if it hasn't been modified
 			if resource.url?
-				UrlCache.downloadUrlToFile(
-					project_id,
-					resource.url,
-					path,
-					resource.modified,
-					callback
-				)
+				UrlCache.downloadUrlToFile project_id, resource.url, path, resource.modified, (err)->
+					if err?
+						logger.err err:err, "error downloading file for resources"
+					callback() #try and continue compiling even if http resource can not be downloaded at this time
 			else
 				fs.writeFile path, resource.content, callback