Skip to content

Commit 2e1bbd7

Browse files
committed
fix(ui): handle non-matching URLs in extractPackageFromRef
1 parent d72a756 commit 2e1bbd7

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

app/components/Package/LikeCard.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ const props = defineProps<{
88
const compactNumberFormatter = useCompactNumberFormatter()
99
1010
function extractPackageFromRef(ref: string) {
11-
const { pkg } = /https:\/\/npmx.dev\/package\/(?<pkg>.*)/.exec(ref).groups
12-
return pkg
11+
return /https:\/\/npmx.dev\/package\/(?<pkg>.*)/.exec(ref)?.groups?.pkg ?? ref
1312
}
1413
1514
const name = computed(() => extractPackageFromRef(props.packageUrl))

0 commit comments

Comments
 (0)