From 4b3aa933a395d6dfacac9aa8914174d67e9af0d7 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 8 Sep 2015 21:58:27 +0100 Subject: [PATCH] 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 --- services/clsi/app/coffee/ResourceWriter.coffee | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/services/clsi/app/coffee/ResourceWriter.coffee b/services/clsi/app/coffee/ResourceWriter.coffee index 78667013a8..faeaf1194e 100644 --- a/services/clsi/app/coffee/ResourceWriter.coffee +++ b/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