Skip to content

Commit

Permalink
Merge branch 'main' into feat-daily-participants
Browse files Browse the repository at this point in the history
  • Loading branch information
bajtos authored Jan 23, 2024
2 parents fd648d0 + 9a7bcb4 commit 92ecc88
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 76 deletions.
5 changes: 2 additions & 3 deletions lib/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ export const createHandler = ({
* @param {import('pg').Pool} pgPool
*/
const handler = async (req, res, pgPool) => {
// Fix the edge case: new URL('//foo', 'http://127.0.0.1') produces href "http://foo/"
const reqUrl = req.url.replace(/^\/+/, '/')
const { pathname, searchParams } = new URL(reqUrl, 'http://127.0.0.1')
// Caveat! `new URL('//foo', 'http://127.0.0.1')` would produce "http://foo/" - not what we want!
const { pathname, searchParams } = new URL(`http://127.0.0.1${req.url}`)
const segs = pathname.split('/').filter(Boolean)
if (req.method === 'GET' && segs[0] === 'retrieval-success-rate' && segs.length === 1) {
await getStatsWithFilterAndCaching(
Expand Down
151 changes: 79 additions & 72 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"standard": "^17.1.0"
},
"dependencies": {
"@sentry/node": "^7.93.0",
"@sentry/node": "^7.94.1",
"debug": "^4.3.4",
"http-assert": "^1.5.0",
"http-responders": "^2.0.2",
Expand Down

0 comments on commit 92ecc88

Please sign in to comment.