Merge pull request #6215 from overleaf/ae-logger-req-params

[logger] Handle undefined req.params

GitOrigin-RevId: cd435d906517034f78fdccc051625cbb537617d4
This commit is contained in:
Eric Mc Sween 2022-02-16 08:03:21 -05:00 committed by Copybot
parent 4dc4286d1b
commit 3864b5831e
3 changed files with 19 additions and 13 deletions

View file

@ -1,3 +1,7 @@
## v3.1.1
* Handle malformed requests in the req serializer
## v3.0.0
* Improve logging in Google Cloud Platform. Set environment variable `GCP_LOGGING=true` to enable.

View file

@ -7,7 +7,7 @@
"url": "https://github.com/overleaf/overleaf"
},
"license": "AGPL-3.0-only",
"version": "3.1.0",
"version": "3.1.1",
"scripts": {
"test": "mocha --grep=$MOCHA_GREP test/**/*.js",
"format": "prettier --list-different $PWD/'**/*.js'",

View file

@ -29,18 +29,20 @@ function reqSerializer(req) {
'content-length': headers['content-length'],
},
}
const projectId =
req.params.projectId || req.params.project_id || req.params.Project_id
const userId = req.params.userId || req.params.user_id
const docId = req.params.docId || req.params.doc_id
if (projectId) {
entry.projectId = projectId
}
if (userId) {
entry.userId = userId
}
if (docId) {
entry.docId = docId
if (req.params) {
const projectId =
req.params.projectId || req.params.project_id || req.params.Project_id
const userId = req.params.userId || req.params.user_id
const docId = req.params.docId || req.params.doc_id
if (projectId) {
entry.projectId = projectId
}
if (userId) {
entry.userId = userId
}
if (docId) {
entry.docId = docId
}
}
return entry
}