update parse
This commit is contained in:
@@ -844,6 +844,7 @@ describe('parseStarterPackHttpUri', () => {
|
||||
'https://bsky.app/start/testlover9000.com',
|
||||
'https://bsky.app/start/testlover9000.com/rkey/other',
|
||||
'https://bsky.app/start',
|
||||
undefined,
|
||||
]
|
||||
const outputs = [
|
||||
{name: 'haileyok.com', rkey: 'rkey'},
|
||||
@@ -852,6 +853,7 @@ describe('parseStarterPackHttpUri', () => {
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
]
|
||||
|
||||
it('returns the correct name and rkey when input is valid', () => {
|
||||
|
||||
@@ -24,10 +24,12 @@ export function createStarterPackLinkFromAndroidReferrer(
|
||||
}
|
||||
}
|
||||
|
||||
export function parseStarterPackHttpUri(uri: string): {
|
||||
export function parseStarterPackHttpUri(uri?: string): {
|
||||
name?: string
|
||||
rkey?: string
|
||||
} | null {
|
||||
if (!uri) return null
|
||||
|
||||
try {
|
||||
const url = new URL(uri)
|
||||
const parts = url.pathname.split('/')
|
||||
|
||||
Reference in New Issue
Block a user