From c7e6e10cb5aa4cfe917bb8ba6847128fc6dcb30c Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 19 Dec 2022 12:29:16 +0000 Subject: [PATCH] fix: handle missing user in github preview --- components/status/StatusPreviewGitHub.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/status/StatusPreviewGitHub.vue b/components/status/StatusPreviewGitHub.vue index b2b53214..c275d7a0 100644 --- a/components/status/StatusPreviewGitHub.vue +++ b/components/status/StatusPreviewGitHub.vue @@ -8,7 +8,7 @@ const props = defineProps<{ type UrlType = 'user' | 'repo' | 'issue' | 'pull' interface Meta { type: UrlType - user: string + user?: string titleUrl: string avatar: string details: string @@ -26,7 +26,7 @@ interface Meta { const meta = $computed(() => { const { url } = props.card const path = url.split('https://github.com/')[1] - const user = path.match(/([\w-]+)\//)![1] + const user = path.match(/([\w-]+)\//)?.[1] const repo = path.match(/[\w-]+\/([\w-]+)/)?.[1] const repoPath = `${user}/${repo}` const inRepoPath = path.split(`${repoPath}/`)?.[1]