forked from gitea/gitea
1
0
Fork 0

Use EscapePound in link hrefs in diff/file views

This commit is contained in:
Vladimir Vissoultchev 2015-07-28 19:51:40 +03:00
parent 43bfee0d48
commit 2bb1fb8f44
3 changed files with 13 additions and 12 deletions

View File

@ -6,7 +6,7 @@
{{if .IsDiffCompare }} {{if .IsDiffCompare }}
<div class="panel panel-info panel-radius compare-head-box"> <div class="panel panel-info panel-radius compare-head-box">
<div class="panel-header"> <div class="panel-header">
<a class="pull-right btn btn-blue btn-header btn-medium btn-radius" rel="nofollow" href="{{.SourcePath}}">{{.i18n.Tr "repo.diff.browse_source"}}</a> <a class="pull-right btn btn-blue btn-header btn-medium btn-radius" rel="nofollow" href="{{EscapePound .SourcePath}}">{{.i18n.Tr "repo.diff.browse_source"}}</a>
<h4><a href="{{$.RepoLink}}/commit/{{.BeforeCommitId}}" class="label label-green">{{ShortSha .BeforeCommitId}}</a> ... <a href="{{$.RepoLink}}/commit/{{.AfterCommitId}}" class="label label-green">{{ShortSha .AfterCommitId}}</a></h4> <h4><a href="{{$.RepoLink}}/commit/{{.BeforeCommitId}}" class="label label-green">{{ShortSha .BeforeCommitId}}</a> ... <a href="{{$.RepoLink}}/commit/{{.AfterCommitId}}" class="label label-green">{{ShortSha .AfterCommitId}}</a></h4>
</div> </div>
<div class="panel-body compare"> <div class="panel-body compare">
@ -16,7 +16,7 @@
{{else}} {{else}}
<div class="panel panel-info panel-radius diff-head-box"> <div class="panel panel-info panel-radius diff-head-box">
<div class="panel-header"> <div class="panel-header">
<a class="pull-right btn btn-blue btn-header btn-medium btn-radius" rel="nofollow" href="{{.SourcePath}}">{{.i18n.Tr "repo.diff.browse_source"}}</a> <a class="pull-right btn btn-blue btn-header btn-medium btn-radius" rel="nofollow" href="{{EscapePound .SourcePath}}">{{.i18n.Tr "repo.diff.browse_source"}}</a>
<h4 class="commit-message">{{RenderCommitMessage .Commit.Message $.RepoLink}}</h4> <h4 class="commit-message">{{RenderCommitMessage .Commit.Message $.RepoLink}}</h4>
</div> </div>
<div class="panel-body"> <div class="panel-body">
@ -37,7 +37,7 @@
<img class="avatar-30" src="{{AvatarLink .Commit.Author.Email}}" /> <img class="avatar-30" src="{{AvatarLink .Commit.Author.Email}}" />
<strong>{{.Commit.Author.Name}}</strong> <strong>{{.Commit.Author.Name}}</strong>
{{end}} {{end}}
<span class="text-grey" id="authored-time">{{TimeSince .Commit.Author.When $.Lang}}</span> <span class="text-grey" id="authored-time">{{TimeSince .Commit.Author.When $.Lang}}</span>
</p> </p>
</div> </div>
</div> </div>
@ -90,9 +90,9 @@
{{end}} {{end}}
</div> </div>
{{if $file.IsDeleted}} {{if $file.IsDeleted}}
<a class="btn btn-gray btn-header btn-radius text-black pull-right" rel="nofollow" href="{{$.BeforeSourcePath}}/{{.Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a> <a class="btn btn-gray btn-header btn-radius text-black pull-right" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
{{else}} {{else}}
<a class="btn btn-gray btn-header btn-radius text-black pull-right" rel="nofollow" href="{{$.SourcePath}}/{{.Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a> <a class="btn btn-gray btn-header btn-radius text-black pull-right" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
{{end}} {{end}}
<span class="file">{{$file.Name}}</span> <span class="file">{{$file.Name}}</span>
</div> </div>
@ -100,7 +100,7 @@
<div class="panel-body file-body file-code code-view code-diff"> <div class="panel-body file-body file-code code-view code-diff">
{{if $isImage}} {{if $isImage}}
<div class="text-center"> <div class="text-center">
<img src="{{$.RawPath}}/{{.Name}}"> <img src="{{$.RawPath}}/{{EscapePound .Name}}">
</div> </div>
{{else}} {{else}}
<table> <table>
@ -114,7 +114,7 @@
<td class="lines-num lines-num-new"> <td class="lines-num lines-num-new">
<span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span> <span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
</td> </td>
<td class="lines-code"> <td class="lines-code">
<pre>{{$line.Content}}</pre> <pre>{{$line.Content}}</pre>
</td> </td>
@ -126,7 +126,7 @@
{{end}} {{end}}
</div> </div>
</div> </div>
<br> <br>
{{end}} {{end}}
{{end}} {{end}}
</div> </div>

View File

@ -50,7 +50,8 @@
{{if eq $i $l}} {{if eq $i $l}}
<span class="bread">{{$v}}</span> <span class="bread">{{$v}}</span>
{{else}} {{else}}
<span class="bread"><a href="{{EscapePound $.BranchLink}}/{{index $.Paths $i}}">{{$v}}</a></span> {{ $p := index $.Paths $i}}
<span class="bread"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{$v}}</a></span>
{{end}} {{end}}
{{end}} {{end}}
</li> </li>

View File

@ -13,11 +13,11 @@
{{end}} {{end}}
{{if not .ReadmeInList}} {{if not .ReadmeInList}}
{{if not .IsCommit}} {{if not .IsCommit}}
<a class="right" href="{{.RepoLink}}/src/{{.CommitId}}/{{.TreeName}}"> <a class="right" href="{{.RepoLink}}/src/{{.CommitId}}/{{EscapePound .TreeName}}">
<button class="btn btn-medium btn-gray btn-right-radius btn-comb">{{.i18n.Tr "repo.file_permalink"}}</button> <button class="btn btn-medium btn-gray btn-right-radius btn-comb">{{.i18n.Tr "repo.file_permalink"}}</button>
</a> </a>
{{end}} {{end}}
<a class="right" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}/{{.TreeName}}"> <a class="right" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}/{{EscapePound .TreeName}}">
<button class="btn btn-medium btn-gray btn-right-radius btn-comb">{{.i18n.Tr "repo.file_history"}}</button> <button class="btn btn-medium btn-gray btn-right-radius btn-comb">{{.i18n.Tr "repo.file_history"}}</button>
</a> </a>
<a class="right" href="{{EscapePound .FileLink}}"> <a class="right" href="{{EscapePound .FileLink}}">
@ -47,4 +47,4 @@
</table> </table>
{{end}} {{end}}
</div> </div>
</div> </div>