From a30d865b781b4611826bf44d60e44d9f6e8fdf4e Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 31 Jul 2026 03:09:32 +0800 Subject: [PATCH] fix: correct full url when using sub-path (#38712) fix #38708 --------- Co-authored-by: silverwind Co-authored-by: Lunny Xiao --- services/context/context_template.go | 2 +- templates/repo/blame.tmpl | 2 +- templates/repo/issue/view_content/context_menu.tmpl | 13 +++++++------ .../issue/view_content/pull_merge_instruction.tmpl | 2 +- templates/repo/view_content.tmpl | 2 +- templates/repo/view_file.tmpl | 2 +- tests/integration/issue_test.go | 5 ++--- tests/integration/repo_test.go | 4 ++-- web_src/js/features/repo-code.ts | 3 +-- web_src/js/features/repo-issue.ts | 3 +-- web_src/js/utils.test.ts | 12 +----------- web_src/js/utils.ts | 13 ------------- 12 files changed, 19 insertions(+), 44 deletions(-) diff --git a/services/context/context_template.go b/services/context/context_template.go index 87877095ab..27d02a4566 100644 --- a/services/context/context_template.go +++ b/services/context/context_template.go @@ -78,7 +78,7 @@ func (c TemplateContext) CurrentWebBanner() *setting.WebBannerType { return nil } -// AppFullLink returns a full URL link with AppSubURL for the given app link (no AppSubURL) +// AppFullLink returns a full URL link with AppSubURL for the given app link // If no link is given, it returns the current app full URL with sub-path but without trailing slash (that's why it is not named as AppURL) func (c TemplateContext) AppFullLink(link ...string) template.URL { s := httplib.GuessCurrentAppURL(c.parentContext()) diff --git a/templates/repo/blame.tmpl b/templates/repo/blame.tmpl index ef3415d52e..944472ed4c 100644 --- a/templates/repo/blame.tmpl +++ b/templates/repo/blame.tmpl @@ -79,7 +79,7 @@ {{/*FIXME: the "HasSourceRenderedToggle" is never set on blame page, it should mean "whether the file is renderable". If the file is renderable, then it must has the "display=source" parameter to make sure the file view page shows the source code, then line number works. */}} {{if $.Permission.CanRead ctx.Consts.RepoUnitTypeIssues}} - {{ctx.Locale.Tr "repo.issues.context.reference_issue"}} + {{ctx.Locale.Tr "repo.issues.context.reference_issue"}} {{end}} {{ctx.Locale.Tr "repo.file_copy_permalink"}} diff --git a/templates/repo/issue/view_content/context_menu.tmpl b/templates/repo/issue/view_content/context_menu.tmpl index a2341e6097..018e51f2ef 100644 --- a/templates/repo/issue/view_content/context_menu.tmpl +++ b/templates/repo/issue/view_content/context_menu.tmpl @@ -3,13 +3,14 @@ {{svg "octicon-kebab-horizontal"}}