From b83109dc11535985753ac6bf5c662c421b7c896d Mon Sep 17 00:00:00 2001
From: Clark Boylan <clark.boylan@gmail.com>
Date: Tue, 6 Sep 2022 15:37:25 -0700
Subject: [PATCH] Update to Gitea 1.17.2

This is the first minor Gitea update we've seen in a long time with
updated template files. I've updated the header.tmpl file to match
1.17.2's content.

Full changelog can be seen at:
  https://github.com/go-gitea/gitea/blob/v1.17.2/CHANGELOG.md#1172---2022-09-06

Change-Id: I087f13beb64e2a3b607f1f60e2d3841567845543
---
 docker/gitea/Dockerfile                        | 2 +-
 docker/gitea/custom/templates/repo/header.tmpl | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/docker/gitea/Dockerfile b/docker/gitea/Dockerfile
index 6d2e02c066..40c579e380 100644
--- a/docker/gitea/Dockerfile
+++ b/docker/gitea/Dockerfile
@@ -27,7 +27,7 @@ FROM docker.io/library/golang:1.18-bullseye AS build-env
 
 LABEL maintainer="infra-root@openstack.org"
 
-ARG GITEA_VERSION="v1.17.1"
+ARG GITEA_VERSION="v1.17.2"
 ENV TAGS "bindata $TAGS"
 
 #Build deps
diff --git a/docker/gitea/custom/templates/repo/header.tmpl b/docker/gitea/custom/templates/repo/header.tmpl
index 10a8be6a59..ee4152c3f8 100644
--- a/docker/gitea/custom/templates/repo/header.tmpl
+++ b/docker/gitea/custom/templates/repo/header.tmpl
@@ -38,7 +38,7 @@
 					</div>
 				</div>
 				{{if $.IsPullMirror}}
-					{{$address := MirrorRemoteAddress $.Context . $.Mirror.GetRemoteName}}
+					{{$address := MirrorRemoteAddress $.Context . $.Mirror.GetRemoteName false}}
 					<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" rel="noopener noreferrer" href="{{$address.Address}}">{{$address.Address}}</a></div>
 				{{end}}
 				{{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{.BaseRepo.FullName}}</a></div>{{end}}
@@ -215,7 +215,7 @@
 				-->
 
 				{{if or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki)}}
-					<a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki" {{if (.Permission.CanRead $.UnitTypeExternalWiki)}} target="_blank" rel="noopener noreferrer" {{end}}>
+					<a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki" {{if and (.Permission.CanRead $.UnitTypeExternalWiki) (not (HasPrefix ((.Repository.MustGetUnit $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL) (.Repository.HTMLURL)))}} target="_blank" rel="noopener noreferrer" {{end}}>
 						{{svg "octicon-book"}} {{.i18n.Tr "repo.wiki"}}
 					</a>
 				{{end}}