mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-10 19:32:02 +00:00
fix: use another method for suggestions
This commit is contained in:
parent
3d4372c8bf
commit
6e2c72cd70
9 changed files with 122 additions and 102 deletions
|
@ -34,6 +34,13 @@ export function parseIssueHref(href) {
|
|||
return {owner, repo, type, index};
|
||||
}
|
||||
|
||||
export function parseRepoOwnerPathInfo(pathname) {
|
||||
const appSubUrl = window.config.appSubUrl;
|
||||
if (appSubUrl && pathname.startsWith(appSubUrl)) pathname = pathname.substring(appSubUrl.length);
|
||||
const [_, ownerName, repoName] = /([^/]+)\/([^/]+)/.exec(pathname) || [];
|
||||
return {ownerName, repoName};
|
||||
}
|
||||
|
||||
// parse a URL, either relative '/path' or absolute 'https://localhost/path'
|
||||
export function parseUrl(str) {
|
||||
return new URL(str, str.startsWith('http') ? undefined : window.location.origin);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue