Commit 7163b5b0 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'handle-invalid-mirror-url' into 'master'

Handle invalid mirror url

See merge request gitlab-org/gitlab-ce!32353
parents e6869b8f 72390953
......@@ -200,6 +200,7 @@ class RemoteMirror < ApplicationRecord
result.password = '*****' if result.password
result.user = '*****' if result.user && result.user != 'git' # tokens or other data may be saved as user
result.to_s
rescue URI::Error
end
def ensure_remote!
......
......@@ -50,7 +50,7 @@
- @project.remote_mirrors.each_with_index do |mirror, index|
- next if mirror.new_record?
%tr.qa-mirrored-repository-row.rspec-mirrored-repository-row{ class: ('bg-secondary' if mirror.disabled?) }
%td.qa-mirror-repository-url= mirror.safe_url
%td.qa-mirror-repository-url= mirror.safe_url || _('Invalid URL')
%td= _('Push')
%td
= mirror.last_update_started_at.present? ? time_ago_with_tooltip(mirror.last_update_started_at) : _('Never')
......
---
title: Handle invalid mirror url
merge_request: 32353
author: Lee Tickett
type: fixed
......@@ -6110,6 +6110,9 @@ msgstr ""
msgid "Invalid Login or password"
msgstr ""
msgid "Invalid URL"
msgstr ""
msgid "Invalid date"
msgstr ""
......
......@@ -40,6 +40,13 @@ describe RemoteMirror, :mailer do
expect(remote_mirror).to be_invalid
expect(remote_mirror.errors[:url].first).to include('Requests to the local network are not allowed')
end
it 'returns a nil safe_url' do
remote_mirror = build(:remote_mirror, url: 'http://[0:0:0:0:ffff:123.123.123.123]/foo.git')
expect(remote_mirror.url).to eq('http://[0:0:0:0:ffff:123.123.123.123]/foo.git')
expect(remote_mirror.safe_url).to be_nil
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment