Skip to content

Commit 601c9a7

Browse files
committed
chore: throw legacy blob refs into the bin
1 parent 86159fc commit 601c9a7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/api/auth/atproto.get.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { SLINGSHOT_HOST } from '#shared/utils/constants'
66
import { useServerSession } from '#server/utils/server-session'
77
import { handleApiError } from '#server/utils/error-handler'
88
import type { DidString } from '@atproto/lex'
9-
import { Client, isAtUriString } from '@atproto/lex'
9+
import { Client, isAtUriString, isTypedBlobRef } from '@atproto/lex'
1010
import * as app from '#shared/types/lexicons/app'
1111
import * as blue from '#shared/types/lexicons/blue'
1212
import { isAtIdentifierString } from '@atproto/lex'
@@ -271,11 +271,11 @@ async function getAvatar(did: DidString, pds: string) {
271271
})
272272

273273
const validatedResponse = app.bsky.actor.profile.main.validate(profileResponse.value)
274-
const cid = validatedResponse.avatar?.ref
274+
const cid = validatedResponse.avatar
275275

276-
if (cid) {
276+
if (cid && isTypedBlobRef(cid) && cid.ref) {
277277
// Use Bluesky CDN for faster image loading
278-
avatar = `https://cdn.bsky.app/img/feed_thumbnail/plain/${did}/${cid}@jpeg`
278+
avatar = `https://cdn.bsky.app/img/feed_thumbnail/plain/${did}/${cid.ref}@jpeg`
279279
}
280280
}
281281
} catch {

0 commit comments

Comments
 (0)