From 0692e964ef4b45f06c32efcdc79a580b6f679386 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Fri, 27 Feb 2015 13:16:01 +0000 Subject: [PATCH] use OutputCacheManager to construct static path to files --- app.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app.coffee b/app.coffee index dd2bae5..ee2e838 100644 --- a/app.coffee +++ b/app.coffee @@ -12,6 +12,7 @@ Metrics.initialize("clsi") Metrics.open_sockets.monitor(logger) ProjectPersistenceManager = require "./app/js/ProjectPersistenceManager" +OutputCacheManager = require "./app/js/OutputCacheManager" require("./app/js/db").sync() @@ -68,8 +69,8 @@ staticServer = staticForbidSymLinks Settings.path.compilesDir, setHeaders: (res, res.set("Content-Type", "text/plain") app.get "/project/:project_id/output/*", require("./app/js/SymlinkCheckerMiddlewear"), (req, res, next) -> - if req.query?.build? && req.query.build.match(/^[0-9]+$/) - req.url = "/#{req.params.project_id}/.cache/clsi/#{req.query.build}/#{req.params[0]}" + if req.query?.build? && req.query.build.match(OutputCacheManager.BUILD_REGEX) + req.url = "/#{req.params.project_id}/" + OutputCacheManager.path(req.query.build) + "/#{req.params[0]}" else req.url = "/#{req.params.project_id}/#{req.params[0]}" staticServer(req, res, next)