Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
72390953
Commit
72390953
authored
Aug 29, 2019
by
Lee Tickett
Committed by
Nick Thomas
Aug 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle invalid mirror url
parent
e6869b8f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
1 deletion
+17
-1
app/models/remote_mirror.rb
app/models/remote_mirror.rb
+1
-0
app/views/projects/mirrors/_mirror_repos.html.haml
app/views/projects/mirrors/_mirror_repos.html.haml
+1
-1
changelogs/unreleased/handle-invalid-mirror-url.yml
changelogs/unreleased/handle-invalid-mirror-url.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/models/remote_mirror_spec.rb
spec/models/remote_mirror_spec.rb
+7
-0
No files found.
app/models/remote_mirror.rb
View file @
72390953
...
@@ -200,6 +200,7 @@ class RemoteMirror < ApplicationRecord
...
@@ -200,6 +200,7 @@ class RemoteMirror < ApplicationRecord
result
.
password
=
'*****'
if
result
.
password
result
.
password
=
'*****'
if
result
.
password
result
.
user
=
'*****'
if
result
.
user
&&
result
.
user
!=
'git'
# tokens or other data may be saved as user
result
.
user
=
'*****'
if
result
.
user
&&
result
.
user
!=
'git'
# tokens or other data may be saved as user
result
.
to_s
result
.
to_s
rescue
URI
::
Error
end
end
def
ensure_remote!
def
ensure_remote!
...
...
app/views/projects/mirrors/_mirror_repos.html.haml
View file @
72390953
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
-
@project
.
remote_mirrors
.
each_with_index
do
|
mirror
,
index
|
-
@project
.
remote_mirrors
.
each_with_index
do
|
mirror
,
index
|
-
next
if
mirror
.
new_record?
-
next
if
mirror
.
new_record?
%tr
.qa-mirrored-repository-row.rspec-mirrored-repository-row
{
class:
(
'bg-secondary'
if
mirror
.
disabled?
)
}
%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
=
_
(
'Push'
)
%td
%td
=
mirror
.
last_update_started_at
.
present?
?
time_ago_with_tooltip
(
mirror
.
last_update_started_at
)
:
_
(
'Never'
)
=
mirror
.
last_update_started_at
.
present?
?
time_ago_with_tooltip
(
mirror
.
last_update_started_at
)
:
_
(
'Never'
)
...
...
changelogs/unreleased/handle-invalid-mirror-url.yml
0 → 100644
View file @
72390953
---
title
:
Handle invalid mirror url
merge_request
:
32353
author
:
Lee Tickett
type
:
fixed
locale/gitlab.pot
View file @
72390953
...
@@ -6110,6 +6110,9 @@ msgstr ""
...
@@ -6110,6 +6110,9 @@ msgstr ""
msgid "Invalid Login or password"
msgid "Invalid Login or password"
msgstr ""
msgstr ""
msgid "Invalid URL"
msgstr ""
msgid "Invalid date"
msgid "Invalid date"
msgstr ""
msgstr ""
...
...
spec/models/remote_mirror_spec.rb
View file @
72390953
...
@@ -40,6 +40,13 @@ describe RemoteMirror, :mailer do
...
@@ -40,6 +40,13 @@ describe RemoteMirror, :mailer do
expect
(
remote_mirror
).
to
be_invalid
expect
(
remote_mirror
).
to
be_invalid
expect
(
remote_mirror
.
errors
[
:url
].
first
).
to
include
(
'Requests to the local network are not allowed'
)
expect
(
remote_mirror
.
errors
[
:url
].
first
).
to
include
(
'Requests to the local network are not allowed'
)
end
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
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment