From 2145a1dd4df0dc2f5850dd457a391be22436f5db Mon Sep 17 00:00:00 2001 From: Thomas <1688389+Rakambda@users.noreply.github.com> Date: Thu, 4 Sep 2025 00:45:36 +0200 Subject: [PATCH] fix(route/threads): Handle getting a number back from the cache (#19958) --- lib/routes/threads/utils.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/routes/threads/utils.ts b/lib/routes/threads/utils.ts index 1909a6251..1b35c346a 100644 --- a/lib/routes/threads/utils.ts +++ b/lib/routes/threads/utils.ts @@ -78,10 +78,14 @@ const getUserId = (user: string): Promise => throw new NotFoundError('User ID not found'); }) .then((result): string => { - if (!result || typeof result !== 'string') { - throw new TypeError('Invalid user ID type'); + if (result) { + if (typeof result === 'string') { + return result; + } else if (typeof result === 'number') { + return result.toString(); + } } - return result; + throw new TypeError('Invalid user ID type'); }); const hasMedia = (post) => post.image_versions2 || post.carousel_media || post.video_versions;