From 1d74e6750cfaac0255493f6907354a56e4f57a0c Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Mon, 18 Jul 2016 17:00:34 +0100 Subject: [PATCH] work around for synctex paths containing /./ --- .../coffee/Features/Compile/CompileController.coffee | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/Compile/CompileController.coffee b/services/web/app/coffee/Features/Compile/CompileController.coffee index 6163fd315b..f3680dc38e 100755 --- a/services/web/app/coffee/Features/Compile/CompileController.coffee +++ b/services/web/app/coffee/Features/Compile/CompileController.coffee @@ -163,7 +163,15 @@ module.exports = CompileController = proxySyncCode: (req, res, next = (error) ->) -> project_id = req.params.Project_id {file, line, column} = req.query - if not file? or Path.resolve("/", file) isnt "/#{file}" + if not file? + return next(new Error("missing file parameter")) + # Check that we are dealing with a simple file path (this is not + # strictly needed because synctex uses this parameter as a label + # to look up in the synctex output, and does not open the file + # itself). Since we have valid synctex paths like foo/./bar we + # allow those by replacing /./ with / + testPath = file.replace '/./', '/' + if Path.resolve("/", testPath) isnt "/#{testPath}" return next(new Error("invalid file parameter")) if not line?.match(/^\d+$/) return next(new Error("invalid line parameter"))