mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-16 17:30:56 +00:00
[misc] CompileController: simplify composing of outputFiles
This commit is contained in:
parent
f32f5e58a8
commit
fb3966ef35
2 changed files with 4 additions and 22 deletions
|
@ -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
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue