From 743cf81ddf3d639551477b31b12561d799a49e3e Mon Sep 17 00:00:00 2001 From: Louis Grasset Date: Sun, 12 Nov 2023 22:18:04 +0100 Subject: [PATCH] fix(regex): rely on .exec --- src/services/bluesky-sender.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/bluesky-sender.service.ts b/src/services/bluesky-sender.service.ts index 8e50b98..ff49882 100644 --- a/src/services/bluesky-sender.service.ts +++ b/src/services/bluesky-sender.service.ts @@ -206,10 +206,11 @@ export const blueskySenderService = async ( ); // Save post ID to be able to reference it while posting the next chunk. + const RKEY_REGEX = /\/(?\w+)$/; chunkReferences.push({ cid: createdPost.cid, uri: createdPost.uri, - rkey: createdPost.uri.match(/\/(?\w+)$/)?.groups?.["rkey"] || "", + rkey: RKEY_REGEX.exec(createdPost.uri)?.groups?.["rkey"] || "", }); // If this is the last chunk, save the all chunks ID to the cache.