ensure we post starter-pack not start links

This commit is contained in:
Hailey
2024-06-26 17:03:20 -07:00
parent f8d11aeed0
commit 160f03f8e2
2 changed files with 6 additions and 1 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
import {logger} from '#/logger'
import {startUriToStarterPackUri} from 'lib/strings/starter-pack'
export async function resolveShortLink(shortLink: string) {
const controller = new AbortController()
@@ -12,7 +13,7 @@ export async function resolveShortLink(shortLink: string) {
if (res.status !== 200) {
return shortLink
}
return res.url
return startUriToStarterPackUri(res.url)
} catch (e: unknown) {
logger.error('Failed to resolve short link', {safeMessage: e})
return null
+4
View File
@@ -99,3 +99,7 @@ export function createStarterPackUri({
}): string | null {
return new AtUri(`at://${did}/app.bsky.graph.starterpack/${rkey}`).toString()
}
export function startUriToStarterPackUri(uri: string) {
return uri.replace('/start/', '/starter-pack/')
}