mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-25 02:36:21 +03:00
fix: handle missing user in github preview
This commit is contained in:
parent
b8ec153244
commit
c7e6e10cb5
1 changed files with 2 additions and 2 deletions
|
@ -8,7 +8,7 @@ const props = defineProps<{
|
||||||
type UrlType = 'user' | 'repo' | 'issue' | 'pull'
|
type UrlType = 'user' | 'repo' | 'issue' | 'pull'
|
||||||
interface Meta {
|
interface Meta {
|
||||||
type: UrlType
|
type: UrlType
|
||||||
user: string
|
user?: string
|
||||||
titleUrl: string
|
titleUrl: string
|
||||||
avatar: string
|
avatar: string
|
||||||
details: string
|
details: string
|
||||||
|
@ -26,7 +26,7 @@ interface Meta {
|
||||||
const meta = $computed(() => {
|
const meta = $computed(() => {
|
||||||
const { url } = props.card
|
const { url } = props.card
|
||||||
const path = url.split('https://github.com/')[1]
|
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 repo = path.match(/[\w-]+\/([\w-]+)/)?.[1]
|
||||||
const repoPath = `${user}/${repo}`
|
const repoPath = `${user}/${repo}`
|
||||||
const inRepoPath = path.split(`${repoPath}/`)?.[1]
|
const inRepoPath = path.split(`${repoPath}/`)?.[1]
|
||||||
|
|
Loading…
Reference in a new issue