Skip to content

Commit b2ecd2c

Browse files
committed
fix: add fetch timeout and encode URI in getNpmxProfile
1 parent 7bde6b7 commit b2ecd2c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

server/api/auth/atproto.get.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ async function getNpmxProfile(handle: string, authSession: OAuthSession) {
292292

293293
// TODO: update with safe client rpc, see `getMiniProfile` response variable
294294
const profileResponse = await fetch(
295-
`https://${SLINGSHOT_HOST}/xrpc/blue.microcosm.repo.getRecordByUri?at_uri=${profileUri}`,
296-
{ headers: { 'User-Agent': 'npmx' } },
295+
`https://${SLINGSHOT_HOST}/xrpc/blue.microcosm.repo.getRecordByUri?at_uri=${encodeURIComponent(profileUri)}`,
296+
{ headers: { 'User-Agent': 'npmx' }, signal: AbortSignal.timeout(5_000) },
297297
)
298298

299299
if (profileResponse.ok) {

0 commit comments

Comments
 (0)