From f677de65534764c9eb08075c093213441f95fdd0 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Thu, 2 Oct 2025 08:08:40 +0300 Subject: [PATCH] refactor: fix formatting issues and improve error handling in avatar script --- apps/api/src/scripts/avatar.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/api/src/scripts/avatar.ts b/apps/api/src/scripts/avatar.ts index 423ff00f..0f0ff95d 100644 --- a/apps/api/src/scripts/avatar.ts +++ b/apps/api/src/scripts/avatar.ts @@ -18,7 +18,7 @@ for (const did of args) { } const plc = await fetch(`https://plc.directory/${user.did}`).then((res) => - res.json(), + res.json() ); const serviceEndpoint = _.get(plc, "service.0.serviceEndpoint"); @@ -28,10 +28,10 @@ for (const did of args) { } const profile = await fetch( - `${serviceEndpoint}/xrpc/com.atproto.repo.getRecord?repo=${user.did}&collection=app.bsky.actor.profile&rkey=self`, + `${serviceEndpoint}/xrpc/com.atproto.repo.getRecord?repo=${user.did}&collection=app.bsky.actor.profile&rkey=self` ).then((res) => res.json()); const ref = _.get(profile, "value.avatar.ref.$link"); - const type = _.get(profile, "value.avatar.mimeType").split("/")[1]; + const type = _.get(profile, "value.avatar.mimeType", "").split("/")[1]; await ctx.db .update(users) .set({ -- 2.51.2