mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Merge pull request #32730 from overleaf/mj-conversion-compiler-luatex
[web] Use LuaLaTeX compiler for converted documents GitOrigin-RevId: e9a0d2020ce40a0ada16eb9afae8b1a08933db49
This commit is contained in:
committed by
Copybot
parent
e7b9a40c0e
commit
78c81cd0d5
@@ -15,6 +15,7 @@ import lodash from 'lodash'
|
||||
import { expressify } from '@overleaf/promise-utils'
|
||||
import { DuplicateNameError, FileTooLargeError } from '../Errors/Errors.js'
|
||||
import DocumentConversionManager from './DocumentConversionManager.mjs'
|
||||
import ProjectOptionsHandler from '../Project/ProjectOptionsHandler.mjs'
|
||||
|
||||
const defaultsDeep = lodash.defaultsDeep
|
||||
|
||||
@@ -191,6 +192,7 @@ async function importDocx(req, res, next) {
|
||||
name,
|
||||
archivePath
|
||||
)
|
||||
await ProjectOptionsHandler.promises.setCompiler(project._id, 'lualatex')
|
||||
res.json({ success: true, project_id: project._id })
|
||||
} finally {
|
||||
await fsPromises.unlink(archivePath).catch(() => {})
|
||||
|
||||
@@ -41,6 +41,11 @@ describe('ProjectUploadController', function () {
|
||||
ctx.EditorController = {
|
||||
promises: {},
|
||||
}
|
||||
ctx.ProjectOptionsHandler = {
|
||||
promises: {
|
||||
setCompiler: sinon.stub().resolves(),
|
||||
},
|
||||
}
|
||||
ctx.DocumentConversionManager = {
|
||||
promises: {
|
||||
convertDocxToLaTeXZipArchive: sinon.stub(),
|
||||
@@ -93,6 +98,13 @@ describe('ProjectUploadController', function () {
|
||||
default: ctx.EditorController,
|
||||
}))
|
||||
|
||||
vi.doMock(
|
||||
'../../../../app/src/Features/Project/ProjectOptionsHandler',
|
||||
() => ({
|
||||
default: ctx.ProjectOptionsHandler,
|
||||
})
|
||||
)
|
||||
|
||||
vi.doMock(
|
||||
'../../../../app/src/Features/Uploads/DocumentConversionManager.mjs',
|
||||
() => ({
|
||||
@@ -477,6 +489,12 @@ describe('ProjectUploadController', function () {
|
||||
).to.have.been.calledWith(ctx.user_id, 'file', ctx.archivePath)
|
||||
})
|
||||
|
||||
it('should set the compiler to lualatex', function (ctx) {
|
||||
expect(
|
||||
ctx.ProjectOptionsHandler.promises.setCompiler
|
||||
).to.have.been.calledWith('new-project-id', 'lualatex')
|
||||
})
|
||||
|
||||
it('should unlink the archive after creating the project', function (ctx) {
|
||||
expect(ctx.fsPromises.unlink).to.have.been.calledWith(ctx.archivePath)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user