Skip to content
Snippets Groups Projects
Commit 72390953 authored by Lee Tickett's avatar Lee Tickett Committed by Nick Thomas
Browse files

Handle invalid mirror url

parent e6869b8f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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!
Loading
Loading
Loading
Loading
@@ -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')
Loading
Loading
---
title: Handle invalid mirror url
merge_request: 32353
author: Lee Tickett
type: fixed
Loading
Loading
@@ -6110,6 +6110,9 @@ msgstr ""
msgid "Invalid Login or password"
msgstr ""
 
msgid "Invalid URL"
msgstr ""
msgid "Invalid date"
msgstr ""
 
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment