diff options
author | zeripath <art27@cantab.net> | 2022-01-11 17:18:52 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-11 18:18:52 +0100 |
commit | 09d2029b6c943e542ae5ddf0a5b890ab92355b0f (patch) | |
tree | bc901659ce2144c1f2261e4d3153704be61ca5ae | |
parent | 0857c197a0f99df599516f7dc2bcd5665bb6c664 (diff) | |
download | gitea-09d2029b6c943e542ae5ddf0a5b890ab92355b0f.tar.gz gitea-09d2029b6c943e542ae5ddf0a5b890ab92355b0f.zip |
Prevent NPE when viewing non-rendered files (#18234)
Fix #18231
Signed-off-by: Andrew Thornton <art27@cantab.net>
-rw-r--r-- | templates/repo/unicode_escape_prompt.tmpl | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/templates/repo/unicode_escape_prompt.tmpl b/templates/repo/unicode_escape_prompt.tmpl index d45df012e1..855d7866a3 100644 --- a/templates/repo/unicode_escape_prompt.tmpl +++ b/templates/repo/unicode_escape_prompt.tmpl @@ -1,17 +1,19 @@ -{{if .EscapeStatus.BadBIDI}} -<div class="ui error message unicode-escape-prompt"> - <span class="close icon hide-panel button" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</span> - <div class="header"> - {{$.root.i18n.Tr "repo.bidi_bad_header"}} - </div> - <p>{{$.root.i18n.Tr "repo.bidi_bad_description" | Str2html}}</p> -</div> -{{else if .EscapeStatus.Escaped}} -<div class="ui warning message unicode-escape-prompt"> - <span class="close icon hide-panel button" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</span> - <div class="header"> - {{$.root.i18n.Tr "repo.unicode_header"}} - </div> - <p>{{$.root.i18n.Tr "repo.unicode_description" | Str2html}}</p> -</div> +{{if .EscapeStatus}} + {{if .EscapeStatus.BadBIDI}} + <div class="ui error message unicode-escape-prompt"> + <span class="close icon hide-panel button" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</span> + <div class="header"> + {{$.root.i18n.Tr "repo.bidi_bad_header"}} + </div> + <p>{{$.root.i18n.Tr "repo.bidi_bad_description" | Str2html}}</p> + </div> + {{else if .EscapeStatus.Escaped}} + <div class="ui warning message unicode-escape-prompt"> + <span class="close icon hide-panel button" data-panel-closest=".message">{{svg "octicon-x" 16 "close inside"}}</span> + <div class="header"> + {{$.root.i18n.Tr "repo.unicode_header"}} + </div> + <p>{{$.root.i18n.Tr "repo.unicode_description" | Str2html}}</p> + </div> + {{end}} {{end}} |