Skip to content

Commit

Permalink
for backward compatibility - handle already encoded id
Browse files Browse the repository at this point in the history
  • Loading branch information
bergholdt committed Feb 5, 2017
1 parent cb292bb commit cccc6a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/gitlab/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def inspect
end

def url_encode(s)
ERB::Util.url_encode(s)
ERB::Util.url_encode(s.gsub('%2F','/'))
end

private
Expand Down
7 changes: 7 additions & 0 deletions spec/gitlab/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@
end

context "fetch project with namespace/repo" do
it "should allow already encoded delimiter" do
stub_get("/projects/gitlab-org%2Fgitlab-ce", "project")
args = ['project', 'gitlab-org%2Fgitlab-ce']
@output = capture_output { Gitlab::CLI.start(args) }
expect(@output).to include('id')
end

it "should encode delimiter" do
stub_get("/projects/gitlab-org%2Fgitlab-ce", "project")
args = ['project', 'gitlab-org/gitlab-ce']
Expand Down

0 comments on commit cccc6a0

Please sign in to comment.