From 1ed935f9113d6dc77d24d1b102608d1b0f635c32 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sat, 9 May 2026 04:26:09 +0800 Subject: [PATCH 1/2] fix: make clone URL respect public URL detection setting (#37615) Fix #37614 --- web_src/js/features/repo-common.ts | 6 +++--- web_src/js/utils/url.test.ts | 18 +----------------- web_src/js/utils/url.ts | 16 ---------------- 3 files changed, 4 insertions(+), 36 deletions(-) diff --git a/web_src/js/features/repo-common.ts b/web_src/js/features/repo-common.ts index 65b89cf261..50d0db3673 100644 --- a/web_src/js/features/repo-common.ts +++ b/web_src/js/features/repo-common.ts @@ -5,7 +5,6 @@ import {showErrorToast} from '../modules/toast.ts'; import {sleep} from '../utils.ts'; import RepoActivityTopAuthors from '../components/RepoActivityTopAuthors.vue'; import {createApp} from 'vue'; -import {toOriginUrl} from '../utils/url.ts'; import {createTippy} from '../modules/tippy.ts'; import {localUserSettings} from '../modules/user-settings.ts'; @@ -79,7 +78,8 @@ function initCloneSchemeUrlSelection(parent: Element) { const isTea = scheme === 'tea'; if (tabHttps) { - tabHttps.textContent = window.origin.split(':')[0].toUpperCase(); // show "HTTP" or "HTTPS" + const link = tabHttps.getAttribute('data-link')!; + tabHttps.textContent = link.split(':')[0].toUpperCase(); // show "HTTP" or "HTTPS" tabHttps.classList.toggle('active', isHttps); } if (tabSsh) { @@ -99,7 +99,7 @@ function initCloneSchemeUrlSelection(parent: Element) { } if (!tab) return; - const link = toOriginUrl(tab.getAttribute('data-link')!); + const link = tab.getAttribute('data-link')!; for (const el of document.querySelectorAll('.js-clone-url')) { if (el.nodeName === 'INPUT') { diff --git a/web_src/js/utils/url.test.ts b/web_src/js/utils/url.test.ts index a2e7339375..0a7e27ca61 100644 --- a/web_src/js/utils/url.test.ts +++ b/web_src/js/utils/url.test.ts @@ -1,4 +1,4 @@ -import {linkifyURLs, pathEscape, pathEscapeSegments, toOriginUrl, urlQueryEscape} from './url.ts'; +import {linkifyURLs, pathEscape, pathEscapeSegments, urlQueryEscape} from './url.ts'; describe('escape', () => { const queryNonAscii = " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"; @@ -45,19 +45,3 @@ test('linkifyURLs', () => { expect(linkifyURLs('https://evil.com/\nonclick=alert(1)')).toEqual(`${link('https://evil.com/')}\nonclick=alert(1)`); expect(linkifyURLs('https://evil.com/"onmouseover=alert(1)')).toEqual(`${link('https://evil.com/"onmouseover=alert')}(1)`); }); - -test('toOriginUrl', () => { - const oldLocation = String(window.location); - for (const origin of ['https://example.com', 'https://example.com:3000']) { - window.location.assign(`${origin}/`); - expect(toOriginUrl('/')).toEqual(`${origin}/`); - expect(toOriginUrl('/org/repo.git')).toEqual(`${origin}/org/repo.git`); - expect(toOriginUrl('https://another.com')).toEqual(`${origin}/`); - expect(toOriginUrl('https://another.com/')).toEqual(`${origin}/`); - expect(toOriginUrl('https://another.com/org/repo.git')).toEqual(`${origin}/org/repo.git`); - expect(toOriginUrl('https://another.com:4000')).toEqual(`${origin}/`); - expect(toOriginUrl('https://another.com:4000/')).toEqual(`${origin}/`); - expect(toOriginUrl('https://another.com:4000/org/repo.git')).toEqual(`${origin}/org/repo.git`); - } - window.location.assign(oldLocation); -}); diff --git a/web_src/js/utils/url.ts b/web_src/js/utils/url.ts index 927f0937a4..84328faf24 100644 --- a/web_src/js/utils/url.ts +++ b/web_src/js/utils/url.ts @@ -57,19 +57,3 @@ export function linkifyURLs(html: string): string { return `${cleanUrl}${trailing}`; // eslint-disable-line github/unescaped-html-literal }); } - -/** Convert an absolute or relative URL to an absolute URL with the current origin. It only - * processes absolute HTTP/HTTPS URLs or relative URLs like '/xxx' or '//host/xxx'. */ -export function toOriginUrl(urlStr: string) { - try { - if (urlStr.startsWith('http://') || urlStr.startsWith('https://') || urlStr.startsWith('/')) { - const {origin, protocol, hostname, port} = window.location; - const url = new URL(urlStr, origin); - url.protocol = protocol; - url.hostname = hostname; - url.port = port || (protocol === 'https:' ? '443' : '80'); - return url.toString(); - } - } catch {} - return urlStr; -} From 73c0239f94e527c49d47d0be53cb21f7653811df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 May 2026 22:46:57 +0200 Subject: [PATCH 2/2] build(deps): bump fast-uri from 3.1.0 to 3.1.2 (#37616) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.1.0 to 3.1.2.
Release notes

Sourced from fast-uri's releases.

v3.1.2

⚠️ Security Release

What's Changed

Full Changelog: https://github.com/fastify/fast-uri/compare/v3.1.1...v3.1.2

v3.1.1

⚠️ Security Release

What's Changed

New Contributors

Full Changelog: https://github.com/fastify/fast-uri/compare/v3.1.0...v3.1.1

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=fast-uri&package-manager=npm_and_yarn&previous-version=3.1.0&new-version=3.1.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/go-gitea/gitea/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pnpm-lock.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e8ba191bd5..edb9fc7481 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3818,6 +3818,11 @@ packages: engines: {node: '>=10'} hasBin: true + semver@7.8.0: + resolution: {integrity: sha512-AcM7dV/5ul4EekoQ29Agm5vri8JNqRyj39o0qpX6vDF2GZrtutZl5RwgD1XnZjiTAfncsJhMI48QQH3sN87YNA==} + engines: {node: '>=10'} + hasBin: true + seroval-plugins@1.5.3: resolution: {integrity: sha512-LhVh4KjjkKmCxOUjoaUwtqbDjyMfnA535yEmmGDuwZcIYtw8ns6tZmeszNTECeUg/3sJpnEjsz/KhQrcPXPw1Q==} engines: {node: '>=10'} @@ -8198,6 +8203,8 @@ snapshots: semver@7.7.4: {} + semver@7.8.0: {} + seroval-plugins@1.5.3(seroval@1.5.3): dependencies: seroval: 1.5.3 @@ -8694,7 +8701,7 @@ snapshots: eslint-visitor-keys: 5.0.1 espree: 11.2.0 esquery: 1.7.0 - semver: 7.7.4 + semver: 7.8.0 transitivePeerDependencies: - supports-color