Merge pull request #2168 from overleaf/pr-restrict-main-file-options

Restrict main file options based on extension.

GitOrigin-RevId: f7d7a61c0454621dd8bc6ab5edce8a89721018ea
This commit is contained in:
Jessica Lawshe
2019-10-03 09:10:00 -05:00
committed by sharelatex
parent 6737637b39
commit ea0270dbdd
13 changed files with 253 additions and 65 deletions
@@ -40,7 +40,7 @@ module.exports = ProjectRootDocManager = {
(doc, path) =>
function(cb) {
if (
/\.R?tex$/.test(Path.extname(path)) &&
ProjectEntityUpdateHandler.isPathValidForRootDoc(path) &&
DocumentHelper.contentHasDocumentclass(doc.lines)
) {
return cb(doc._id)
@@ -232,14 +232,11 @@ module.exports = ProjectRootDocManager = {
if (rootDocValid) {
return callback()
} else {
return ProjectEntityUpdateHandler.setRootDoc(
project_id,
null,
() =>
ProjectRootDocManager.setRootDocAutomatically(
project_id,
callback
)
return ProjectEntityUpdateHandler.unsetRootDoc(project_id, () =>
ProjectRootDocManager.setRootDocAutomatically(
project_id,
callback
)
)
}
}