mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-05 01:19:20 +08:00
Fix push mirror address backend get error Address cause setting page display error (#20593) (#20901)
This commit is contained in:
parent
37458bffbf
commit
ebc8801fb2
@ -974,11 +974,11 @@ type remoteAddress struct {
|
|||||||
Password string
|
Password string
|
||||||
}
|
}
|
||||||
|
|
||||||
func mirrorRemoteAddress(ctx context.Context, m *repo_model.Repository, remoteName string) remoteAddress {
|
func mirrorRemoteAddress(ctx context.Context, m *repo_model.Repository, remoteName string, ignoreOriginalURL bool) remoteAddress {
|
||||||
a := remoteAddress{}
|
a := remoteAddress{}
|
||||||
|
|
||||||
remoteURL := m.OriginalURL
|
remoteURL := m.OriginalURL
|
||||||
if remoteURL == "" {
|
if ignoreOriginalURL || remoteURL == "" {
|
||||||
var err error
|
var err error
|
||||||
remoteURL, err = git.GetRemoteAddress(ctx, m.RepoPath(), remoteName)
|
remoteURL, err = git.GetRemoteAddress(ctx, m.RepoPath(), remoteName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{if $.IsPullMirror}}
|
{{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>
|
<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" rel="noopener noreferrer" href="{{$address.Address}}">{{$address.Address}}</a></div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{.BaseRepo.FullName}}</a></div>{{end}}
|
{{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{.BaseRepo.FullName}}</a></div>{{end}}
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
{{if .Repository.IsMirror}}
|
{{if .Repository.IsMirror}}
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{(MirrorRemoteAddress $.Context .Repository .Mirror.GetRemoteName).Address}}</td>
|
<td>{{(MirrorRemoteAddress $.Context .Repository .Mirror.GetRemoteName false).Address}}</td>
|
||||||
<td>{{$.i18n.Tr "repo.settings.mirror_settings.direction.pull"}}</td>
|
<td>{{$.i18n.Tr "repo.settings.mirror_settings.direction.pull"}}</td>
|
||||||
<td>{{.Mirror.UpdatedUnix.AsTime}}</td>
|
<td>{{.Mirror.UpdatedUnix.AsTime}}</td>
|
||||||
<td class="right aligned">
|
<td class="right aligned">
|
||||||
@ -119,7 +119,7 @@
|
|||||||
<label for="interval">{{.i18n.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label>
|
<label for="interval">{{.i18n.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label>
|
||||||
<input id="interval" name="interval" value="{{.MirrorInterval}}">
|
<input id="interval" name="interval" value="{{.MirrorInterval}}">
|
||||||
</div>
|
</div>
|
||||||
{{$address := MirrorRemoteAddress $.Context .Repository .Mirror.GetRemoteName}}
|
{{$address := MirrorRemoteAddress $.Context .Repository .Mirror.GetRemoteName false}}
|
||||||
<div class="field {{if .Err_MirrorAddress}}error{{end}}">
|
<div class="field {{if .Err_MirrorAddress}}error{{end}}">
|
||||||
<label for="mirror_address">{{.i18n.Tr "repo.mirror_address"}}</label>
|
<label for="mirror_address">{{.i18n.Tr "repo.mirror_address"}}</label>
|
||||||
<input id="mirror_address" name="mirror_address" value="{{$address.Address}}" required>
|
<input id="mirror_address" name="mirror_address" value="{{$address.Address}}" required>
|
||||||
@ -168,7 +168,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{{range .PushMirrors}}
|
{{range .PushMirrors}}
|
||||||
<tr>
|
<tr>
|
||||||
{{$address := MirrorRemoteAddress $.Context $.Repository .GetRemoteName}}
|
{{$address := MirrorRemoteAddress $.Context $.Repository .GetRemoteName true}}
|
||||||
<td>{{$address.Address}}</td>
|
<td>{{$address.Address}}</td>
|
||||||
<td>{{$.i18n.Tr "repo.settings.mirror_settings.direction.push"}}</td>
|
<td>{{$.i18n.Tr "repo.settings.mirror_settings.direction.push"}}</td>
|
||||||
<td>{{if .LastUpdateUnix}}{{.LastUpdateUnix.AsTime}}{{else}}{{$.i18n.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label tooltip" data-content="{{.LastError}}">{{$.i18n.Tr "error"}}</div>{{end}}</td>
|
<td>{{if .LastUpdateUnix}}{{.LastUpdateUnix.AsTime}}{{else}}{{$.i18n.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label tooltip" data-content="{{.LastError}}">{{$.i18n.Tr "error"}}</div>{{end}}</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user