From a7cb7e6e4c46d4b0974fd728c0fa1572279adcfa Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 26 Sep 2017 11:03:20 +0100 Subject: [PATCH] use a separate function for hidden file check --- services/clsi/app/coffee/OutputCacheManager.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/clsi/app/coffee/OutputCacheManager.coffee b/services/clsi/app/coffee/OutputCacheManager.coffee index 41786af905..23e179c425 100644 --- a/services/clsi/app/coffee/OutputCacheManager.coffee +++ b/services/clsi/app/coffee/OutputCacheManager.coffee @@ -64,7 +64,7 @@ module.exports = OutputCacheManager = results = [] async.mapSeries outputFiles, (file, cb) -> # don't send dot files as output, express doesn't serve them - if file?.path?.match(/^\.|\/./) + if OutputCacheManager._fileIsHidden(file.path) logger.warn compileDir: compileDir, path: file.path, "ignoring dotfile in output" return cb() # copy other files into cache directory if valid @@ -149,6 +149,9 @@ module.exports = OutputCacheManager = removeDir dir, cb , callback + _fileIsHidden: (path) -> + return path?.match(/^\.|\/./)? + _checkFileIsSafe: (src, callback = (error, isSafe) ->) -> # check if we have a valid file to copy into the cache fs.stat src, (err, stats) ->