[misc] CompileController: simplify composing of outputFiles

This commit is contained in:
Jakob Ackermann 2021-06-22 12:13:19 +01:00
parent f32f5e58a8
commit fb3966ef35
2 changed files with 4 additions and 22 deletions

View file

@ -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
})
}
})

View file

@ -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
}
})
}