diff options
Diffstat (limited to 'web_src/js/utils.ts')
-rw-r--r-- | web_src/js/utils.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/web_src/js/utils.ts b/web_src/js/utils.ts index 997a4d1ff3..2a2bdc60f9 100644 --- a/web_src/js/utils.ts +++ b/web_src/js/utils.ts @@ -39,8 +39,9 @@ export function parseIssueHref(href: string): IssuePathInfo { export function parseIssueNewHref(href: string): IssuePathInfo { const path = (href || '').replace(/[#?].*$/, ''); - const [_, ownerName, repoName, pathType, indexString] = /([^/]+)\/([^/]+)\/(issues|pulls)\/new/.exec(path) || []; - return {ownerName, repoName, pathType, indexString}; + const [_, ownerName, repoName, pathTypeField] = /([^/]+)\/([^/]+)\/(issues\/new|compare\/.+\.\.\.)/.exec(path) || []; + const pathType = pathTypeField ? (pathTypeField.startsWith('issues/new') ? 'issues' : 'pulls') : undefined; + return {ownerName, repoName, pathType}; } export function parseIssuePageInfo(): IssuePageInfo { |