From dbeff9a7b8b960801d3dd3b575fbca63df3a74de Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 26 Sep 2017 10:42:59 +0100 Subject: [PATCH] exclude hidden files from output express static server doesn't serve them and rejects with 404 --- app/coffee/OutputCacheManager.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/coffee/OutputCacheManager.coffee b/app/coffee/OutputCacheManager.coffee index 465b043..41786af 100644 --- a/app/coffee/OutputCacheManager.coffee +++ b/app/coffee/OutputCacheManager.coffee @@ -63,6 +63,11 @@ module.exports = OutputCacheManager = # copy all the output files into the new cache directory results = [] async.mapSeries outputFiles, (file, cb) -> + # don't send dot files as output, express doesn't serve them + if file?.path?.match(/^\.|\/./) + logger.warn compileDir: compileDir, path: file.path, "ignoring dotfile in output" + return cb() + # copy other files into cache directory if valid newFile = _.clone(file) [src, dst] = [Path.join(compileDir, file.path), Path.join(cacheDir, file.path)] OutputCacheManager._checkFileIsSafe src, (err, isSafe) ->