BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
f2f345e6
Commit
f2f345e6
authored
May 23, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid encoding import url and delegate good format to user
parent
8a91f3f2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
17 deletions
+1
-17
import_url.rb
lib/gitlab/import_url.rb
+1
-5
import_url_spec.rb
spec/lib/gitlab/import_url_spec.rb
+0
-12
No files found.
lib/gitlab/import_url.rb
View file @
f2f345e6
module
Gitlab
class
ImportUrl
def
initialize
(
url
,
credentials:
nil
)
@url
=
URI
.
parse
(
encode
(
url
)
)
@url
=
URI
.
parse
(
url
)
@credentials
=
credentials
end
...
...
@@ -37,9 +37,5 @@ module Gitlab
def
valid_credentials?
credentials
&&
credentials
.
is_a?
(
Hash
)
&&
credentials
.
any?
end
def
encode
(
url
)
URI
.
decode
(
url
).
size
<
url
.
size
?
url
:
URI
.
encode
(
url
)
end
end
end
spec/lib/gitlab/import_url_spec.rb
View file @
f2f345e6
...
...
@@ -19,16 +19,4 @@ describe Gitlab::ImportUrl do
describe
'credentials'
do
it
{
expect
(
import_url
.
credentials
).
to
eq
(
credentials
)
}
end
context
'URL encoding'
do
describe
'not encoded URL'
do
let
(
:url
)
{
"https://github.com/me/my project.git"
}
it
{
expect
(
import_url
.
sanitized_url
).
to
eq
(
"https://github.com/me/my%20project.git"
)
}
end
describe
'already encoded URL'
do
let
(
:url
)
{
"https://github.com/me/my%20project.git"
}
it
{
expect
(
import_url
.
sanitized_url
).
to
eq
(
"https://github.com/me/my%20project.git"
)
}
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