Fixed issue raised in https://github.com/caprover/caprover/pull/2362\#issuecomment-3609213641
Run build / build (push) Has been cancelled
Run formatter / check-code-formatting (push) Has been cancelled
Run lint / run-lint (push) Has been cancelled
Build and push the edge image / run-pre-checks (push) Has been cancelled
Build and push the edge image / build-publish-docker-hub (push) Has been cancelled

This commit is contained in:
Kasra Bigdeli
2025-12-03 22:59:41 -08:00
parent 3ad3ef59bc
commit edee7d8613
+26 -14
View File
@@ -474,21 +474,33 @@ router.get('/goaccess/:appName/files/:file', async function (req, res, next) {
})
}
const path = `${appName}/${file}`
res.sendFile(
path,
{ root: CaptainConstants.nginxSharedLogsPathOnHost },
function (error) {
if (error !== undefined) {
Logger.e(error, 'Error getting GoAccess report ' + path)
const baseApi = new BaseApi(
ApiStatusCodes.NOT_FOUND,
'Report not found'
)
res.send(baseApi)
}
}
const fileRelativePath = `${appName}/${file}`
const absolutePath = path.join(
CaptainConstants.nginxSharedLogsPathOnHost,
appName,
file
)
return Promise.resolve()
.then(function () {
return fs.readFile(absolutePath, 'utf8')
})
.then(function (fileContents) {
const baseApi = new BaseApi(
ApiStatusCodes.STATUS_OK,
'GoAccess report retrieved'
)
baseApi.data = fileContents
res.send(baseApi)
})
.catch(function (error) {
Logger.e(error, 'Error getting GoAccess report ' + fileRelativePath)
const baseApi = new BaseApi(
ApiStatusCodes.NOT_FOUND,
'Report not found'
)
res.send(baseApi)
})
})
router.get('/nginxconfig/', function (req, res, next) {