Skip to content

Commit

Permalink
trim to empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
nonrational committed Oct 19, 2024
1 parent 09fe5a0 commit 41f19b2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ const UNKNOWN: AgentReleaseInfo = {
}

const buildAgentInfo = (req: Request): AgentInfo => {
const source = new URL(req.url).searchParams?.get('ua') ? 'query' : 'header'
const userAgentString = new URL(req.url).searchParams?.get('ua') || req.headers.get('user-agent')
const queryParamValue = new URL(req.url).searchParams?.get('ua')?.trim()
const source = queryParamValue ? 'query' : 'header'
const userAgentString = queryParamValue || req.headers.get('user-agent')

const userAgent = new UserAgent(userAgentString)

Expand Down

0 comments on commit 41f19b2

Please sign in to comment.