]> source.dussan.org Git - gitea.git/commitdiff
Fix wrong usage of PathEscapeSegments in branch list page (#25864)
authoryp05327 <576951401@qq.com>
Fri, 14 Jul 2023 06:08:38 +0000 (15:08 +0900)
committerGitHub <noreply@github.com>
Fri, 14 Jul 2023 06:08:38 +0000 (06:08 +0000)
Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/21ce7bfa-36f7-4125-9a66-d644400916a8)

emmm, don't know how to write a good title to describe this issue.
If you have a good idea, I can change the title.

The fix code is copied from L122. Not sure it is right or not.

@lunny
Maybe `DefaultBranchBranch` is also typo?
Two `Branch` in variable name .

templates/repo/branch/list.tmpl

index e9d5cc1efb99c527db8fcb2d0dd4486f045c1f7d..297427eeebd55fcc8a7ae91bac3716c1d02fb022 100644 (file)
                                                                                {{end}}
                                                                        {{else if and .LatestPullRequest.HasMerged .MergeMovedOn}}
                                                                                {{if and (not .DBBranch.IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}}
-                                                                               <a href="{{$.RepoLink}}/compare/{{PathEscapeSegments $.DefaultBranchBranch}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{$.Owner.Name}}:{{end}}{{.Name | PathEscapeSegments}}">
+                                                                               <a href="{{$.RepoLink}}/compare/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{PathEscape $.Owner.Name}}:{{end}}{{PathEscapeSegments .DBBranch.Name}}">
                                                                                        <button id="new-pull-request" class="ui compact basic button gt-mr-0">{{if $.CanPull}}{{$.locale.Tr "repo.pulls.compare_changes"}}{{else}}{{$.locale.Tr "action.compare_branch"}}{{end}}</button>
                                                                                </a>
                                                                                {{end}}