Lookup correct compiler when importing v1 templates

bug: overleaf/sharelatex#981
Signed-off-by: Simon Detheridge <s@sd.ai>
This commit is contained in:
Simon Detheridge 2018-10-04 16:42:03 +01:00
parent 6b8eb0ac23
commit 2b8ce379f8

View file

@ -12,6 +12,12 @@ uuid = require('uuid')
logger = require('logger-sharelatex') logger = require('logger-sharelatex')
async = require("async") async = require("async")
ENGINE_TO_COMPILER_MAP = {
latex_dvipdf: "latex"
pdflatex: "pdflatex"
xelatex: "xelatex"
lualatex: "lualatex"
}
module.exports = TemplatesController = module.exports = TemplatesController =
@ -25,7 +31,7 @@ module.exports = TemplatesController =
data.templateVersionId = templateVersionId data.templateVersionId = templateVersionId
data.templateId = templateId data.templateId = templateId
data.name = req.query.templateName data.name = req.query.templateName
data.compiler = req.query.latexEngine data.compiler = ENGINE_TO_COMPILER_MAP[req.query.latexEngine]
data.mainFile = req.query.mainFile data.mainFile = req.query.mainFile
res.render path.resolve(__dirname, "../../../views/project/editor/new_from_template"), data res.render path.resolve(__dirname, "../../../views/project/editor/new_from_template"), data