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