···167 } catch (e) {
168 console.error('Unexpected error in convertBskyAppUrlIfNeeded()', e)
169 }
000170 }
171 return url
172}
···288}
289290export function isShortLink(url: string): boolean {
0000291 try {
292 const urlp = new URL(url)
293- return urlp.host === 'go.bsky.app'
000000294 } catch (e) {
295 logger.error('Failed to parse possible short link', {safeMessage: e})
296- return false
297 }
298}
···167 } catch (e) {
168 console.error('Unexpected error in convertBskyAppUrlIfNeeded()', e)
169 }
170+ } else if (isShortLink(url)) {
171+ // We only want to do this on native, web handles the 301 for us
172+ return shortLinkToHref(url)
173 }
174 return url
175}
···291}
292293export function isShortLink(url: string): boolean {
294+ return url.startsWith('https://go.bsky.app/')
295+}
296+297+export function shortLinkToHref(url: string): string {
298 try {
299 const urlp = new URL(url)
300+301+ // For now we only support starter packs, but in the future we should add additional paths to this check
302+ const parts = urlp.pathname.split('/').filter(Boolean)
303+ if (parts.length === 1) {
304+ return `/starter-pack-short/${parts[0]}`
305+ }
306+ return url
307 } catch (e) {
308 logger.error('Failed to parse possible short link', {safeMessage: e})
309+ return url
310 }
311}