mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
[misc] CompileController: simplify composing of outputFiles
This commit is contained in:
@@ -123,7 +123,7 @@ module.exports = CompileController = {
|
||||
stats,
|
||||
timings,
|
||||
outputFiles: outputFiles.map((file) => {
|
||||
const record = {
|
||||
return {
|
||||
url:
|
||||
`${Settings.apis.clsi.url}/project/${request.project_id}` +
|
||||
(request.user_id != null
|
||||
@@ -131,18 +131,8 @@ module.exports = CompileController = {
|
||||
: '') +
|
||||
(file.build != null ? `/build/${file.build}` : '') +
|
||||
`/output/${file.path}`,
|
||||
path: file.path,
|
||||
type: file.type,
|
||||
build: file.build,
|
||||
contentId: file.contentId
|
||||
...file
|
||||
}
|
||||
if (file.ranges != null) {
|
||||
record.ranges = file.ranges
|
||||
}
|
||||
if (file.size != null) {
|
||||
record.size = file.size
|
||||
}
|
||||
return record
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -157,11 +157,7 @@ describe('CompileController', function () {
|
||||
outputFiles: this.output_files.map((file) => {
|
||||
return {
|
||||
url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
|
||||
path: file.path,
|
||||
type: file.type,
|
||||
build: file.build,
|
||||
// gets dropped by JSON.stringify
|
||||
contentId: undefined
|
||||
...file
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -202,11 +198,7 @@ describe('CompileController', function () {
|
||||
outputFiles: this.output_files.map((file) => {
|
||||
return {
|
||||
url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
|
||||
path: file.path,
|
||||
type: file.type,
|
||||
build: file.build,
|
||||
// gets dropped by JSON.stringify
|
||||
contentId: undefined
|
||||
...file
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user