1
0
Fork 0
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:
Maxim Slipenko 2025-06-07 18:21:41 +03:00
parent 3d4372c8bf
commit 6e2c72cd70
9 changed files with 122 additions and 102 deletions

View file

@ -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);