Skip to content

Commit 9f53954

Browse files
author
Paolo Mainardi
committed
refs #81: Change urlencode to rawurlencode
1 parent f41e8d7 commit 9f53954

File tree

9 files changed

+49
-49
lines changed

9 files changed

+49
-49
lines changed

lib/Gitlab/Api/AbstractApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,6 @@ protected function delete($path, array $parameters = array(), $requestHeaders =
111111
*/
112112
protected function getProjectPath($id, $path)
113113
{
114-
return 'projects/'.urlencode($id).'/'.$path;
114+
return 'projects/'.rawurlencode($id).'/'.$path;
115115
}
116116
}

lib/Gitlab/Api/Groups.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function all($page = 1, $per_page = self::PER_PAGE)
2323
*/
2424
public function search($query, $page = 1, $per_page = self::PER_PAGE)
2525
{
26-
return $this->get('groups?search='.urlencode($query), array(
26+
return $this->get('groups?search='.rawurlencode($query), array(
2727
'page' => $page,
2828
'per_page' => $per_page
2929
));
@@ -35,7 +35,7 @@ public function search($query, $page = 1, $per_page = self::PER_PAGE)
3535
*/
3636
public function show($id)
3737
{
38-
return $this->get('groups/'.urlencode($id));
38+
return $this->get('groups/'.rawurlencode($id));
3939
}
4040

4141
/**
@@ -59,7 +59,7 @@ public function create($name, $path, $description = null)
5959
*/
6060
public function remove($group_id)
6161
{
62-
return $this->delete('groups/'.urlencode($group_id));
62+
return $this->delete('groups/'.rawurlencode($group_id));
6363
}
6464

6565
/**
@@ -69,7 +69,7 @@ public function remove($group_id)
6969
*/
7070
public function transfer($group_id, $project_id)
7171
{
72-
return $this->post('groups/'.urlencode($group_id).'/projects/'.urlencode($project_id));
72+
return $this->post('groups/'.rawurlencode($group_id).'/projects/'.rawurlencode($project_id));
7373
}
7474

7575
/**
@@ -80,7 +80,7 @@ public function transfer($group_id, $project_id)
8080
*/
8181
public function members($id, $page = 1, $per_page = self::PER_PAGE)
8282
{
83-
return $this->get('groups/'.urlencode($id).'/members', array(
83+
return $this->get('groups/'.rawurlencode($id).'/members', array(
8484
'page' => $page,
8585
'per_page' => $per_page
8686
));
@@ -94,7 +94,7 @@ public function members($id, $page = 1, $per_page = self::PER_PAGE)
9494
*/
9595
public function addMember($group_id, $user_id, $access_level)
9696
{
97-
return $this->post('groups/'.urlencode($group_id).'/members', array(
97+
return $this->post('groups/'.rawurlencode($group_id).'/members', array(
9898
'user_id' => $user_id,
9999
'access_level' => $access_level
100100
));
@@ -108,7 +108,7 @@ public function addMember($group_id, $user_id, $access_level)
108108
*/
109109
public function saveMember($group_id, $user_id, $access_level)
110110
{
111-
return $this->put('groups/'.urlencode($group_id).'/members/'.urlencode($user_id), array(
111+
return $this->put('groups/'.rawurlencode($group_id).'/members/'.rawurlencode($user_id), array(
112112
'access_level' => $access_level
113113
));
114114
}
@@ -120,6 +120,6 @@ public function saveMember($group_id, $user_id, $access_level)
120120
*/
121121
public function removeMember($group_id, $user_id)
122122
{
123-
return $this->delete('groups/'.urlencode($group_id).'/members/'.urlencode($user_id));
123+
return $this->delete('groups/'.rawurlencode($group_id).'/members/'.rawurlencode($user_id));
124124
}
125125
}

lib/Gitlab/Api/Issues.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function all($project_id = null, $page = 1, $per_page = self::PER_PAGE, a
2929
*/
3030
public function show($project_id, $issue_id)
3131
{
32-
return $this->get($this->getProjectPath($project_id, 'issues/'.urlencode($issue_id)));
32+
return $this->get($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id)));
3333
}
3434

3535
/**
@@ -50,7 +50,7 @@ public function create($project_id, array $params)
5050
*/
5151
public function update($project_id, $issue_id, array $params)
5252
{
53-
return $this->put($this->getProjectPath($project_id, 'issues/'.urlencode($issue_id)), $params);
53+
return $this->put($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id)), $params);
5454
}
5555

5656
/**
@@ -60,7 +60,7 @@ public function update($project_id, $issue_id, array $params)
6060
*/
6161
public function showComments($project_id, $issue_id)
6262
{
63-
return $this->get($this->getProjectPath($project_id, 'issues/'.urlencode($issue_id)).'/notes');
63+
return $this->get($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id)).'/notes');
6464
}
6565

6666
/**
@@ -71,7 +71,7 @@ public function showComments($project_id, $issue_id)
7171
*/
7272
public function showComment($project_id, $issue_id, $note_id)
7373
{
74-
return $this->get($this->getProjectPath($project_id, 'issues/'.urlencode($issue_id)).'/notes/'.urlencode($note_id));
74+
return $this->get($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id)).'/notes/'.rawurlencode($note_id));
7575
}
7676

7777
/**
@@ -89,7 +89,7 @@ public function addComment($project_id, $issue_id, $body)
8989
$params = array('body' => $body);
9090
}
9191

92-
return $this->post($this->getProjectPath($project_id, 'issues/'.urlencode($issue_id).'/notes'), $params);
92+
return $this->post($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id).'/notes'), $params);
9393
}
9494

9595
/**
@@ -101,7 +101,7 @@ public function addComment($project_id, $issue_id, $body)
101101
*/
102102
public function updateComment($project_id, $issue_id, $note_id, $body)
103103
{
104-
return $this->put($this->getProjectPath($project_id, 'issues/'.urlencode($issue_id).'/notes/'.urlencode($note_id)), array(
104+
return $this->put($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id).'/notes/'.rawurlencode($note_id)), array(
105105
'body' => $body
106106
));
107107
}

lib/Gitlab/Api/MergeRequests.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function closed($project_id, $page = 1, $per_page = self::PER_PAGE, $orde
8989
*/
9090
public function show($project_id, $mr_id)
9191
{
92-
return $this->get($this->getProjectPath($project_id, 'merge_request/'.urlencode($mr_id)));
92+
return $this->get($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id)));
9393
}
9494

9595
/**
@@ -122,7 +122,7 @@ public function create($project_id, $source, $target, $title, $assignee = null,
122122
*/
123123
public function update($project_id, $mr_id, array $params)
124124
{
125-
return $this->put($this->getProjectPath($project_id, 'merge_request/'.urlencode($mr_id)), $params);
125+
return $this->put($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id)), $params);
126126
}
127127

128128
/**
@@ -139,7 +139,7 @@ public function merge($project_id, $mr_id, $message = null)
139139
$params = array('merge_commit_message' => $message);
140140
}
141141

142-
return $this->put($this->getProjectPath($project_id, 'merge_request/'.urlencode($mr_id).'/merge'), $params);
142+
return $this->put($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id).'/merge'), $params);
143143
}
144144

145145
/**
@@ -149,7 +149,7 @@ public function merge($project_id, $mr_id, $message = null)
149149
*/
150150
public function showComments($project_id, $mr_id)
151151
{
152-
return $this->get($this->getProjectPath($project_id, 'merge_request/'.urlencode($mr_id).'/comments'));
152+
return $this->get($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id).'/comments'));
153153
}
154154

155155
/**
@@ -160,7 +160,7 @@ public function showComments($project_id, $mr_id)
160160
*/
161161
public function addComment($project_id, $mr_id, $note)
162162
{
163-
return $this->post($this->getProjectPath($project_id, 'merge_request/'.urlencode($mr_id).'/comments'), array(
163+
return $this->post($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id).'/comments'), array(
164164
'note' => $note
165165
));
166166
}
@@ -172,6 +172,6 @@ public function addComment($project_id, $mr_id, $note)
172172
*/
173173
public function changes($project_id, $mr_id)
174174
{
175-
return $this->get($this->getProjectPath($project_id, 'merge_request/'.urlencode($mr_id).'/changes'));
175+
return $this->get($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id).'/changes'));
176176
}
177177
}

lib/Gitlab/Api/Milestones.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function all($project_id, $page = 1, $per_page = self::PER_PAGE)
2323
*/
2424
public function show($project_id, $milestone_id)
2525
{
26-
return $this->get($this->getProjectPath($project_id, 'milestones/'.urlencode($milestone_id)));
26+
return $this->get($this->getProjectPath($project_id, 'milestones/'.rawurlencode($milestone_id)));
2727
}
2828

2929
/**
@@ -44,7 +44,7 @@ public function create($project_id, array $params)
4444
*/
4545
public function update($project_id, $milestone_id, array $params)
4646
{
47-
return $this->put($this->getProjectPath($project_id, 'milestones/'.urlencode($milestone_id)), $params);
47+
return $this->put($this->getProjectPath($project_id, 'milestones/'.rawurlencode($milestone_id)), $params);
4848
}
4949

5050
/**
@@ -54,6 +54,6 @@ public function update($project_id, $milestone_id, array $params)
5454
*/
5555
public function issues($project_id, $milestone_id)
5656
{
57-
return $this->get($this->getProjectPath($project_id, 'milestones/'.urlencode($milestone_id).'/issues'));
57+
return $this->get($this->getProjectPath($project_id, 'milestones/'.rawurlencode($milestone_id).'/issues'));
5858
}
5959
}

lib/Gitlab/Api/Repositories.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function branches($project_id)
1818
*/
1919
public function branch($project_id, $branch_id)
2020
{
21-
return $this->get($this->getProjectPath($project_id, 'repository/branches/'.urlencode($branch_id)));
21+
return $this->get($this->getProjectPath($project_id, 'repository/branches/'.rawurlencode($branch_id)));
2222
}
2323

2424
/**
@@ -42,7 +42,7 @@ public function createBranch($project_id, $branch_name, $ref)
4242
*/
4343
public function deleteBranch($project_id, $branch_name)
4444
{
45-
return $this->delete($this->getProjectPath($project_id, 'repository/branches/'.urlencode($branch_name)));
45+
return $this->delete($this->getProjectPath($project_id, 'repository/branches/'.rawurlencode($branch_name)));
4646
}
4747

4848
/**
@@ -52,7 +52,7 @@ public function deleteBranch($project_id, $branch_name)
5252
*/
5353
public function protectBranch($project_id, $branch_name)
5454
{
55-
return $this->put($this->getProjectPath($project_id, 'repository/branches/'.urlencode($branch_name).'/protect'));
55+
return $this->put($this->getProjectPath($project_id, 'repository/branches/'.rawurlencode($branch_name).'/protect'));
5656
}
5757

5858
/**
@@ -62,7 +62,7 @@ public function protectBranch($project_id, $branch_name)
6262
*/
6363
public function unprotectBranch($project_id, $branch_name)
6464
{
65-
return $this->put($this->getProjectPath($project_id, 'repository/branches/'.urlencode($branch_name).'/unprotect'));
65+
return $this->put($this->getProjectPath($project_id, 'repository/branches/'.rawurlencode($branch_name).'/unprotect'));
6666
}
6767

6868
/**
@@ -113,7 +113,7 @@ public function commits($project_id, $page = 0, $per_page = self::PER_PAGE, $ref
113113
*/
114114
public function commit($project_id, $sha)
115115
{
116-
return $this->get($this->getProjectPath($project_id, 'repository/commits/'.urlencode($sha)));
116+
return $this->get($this->getProjectPath($project_id, 'repository/commits/'.rawurlencode($sha)));
117117
}
118118

119119
/**
@@ -125,7 +125,7 @@ public function commit($project_id, $sha)
125125
*/
126126
public function commitComments($project_id, $sha, $page = 0, $per_page = self::PER_PAGE)
127127
{
128-
return $this->get($this->getProjectPath($project_id, 'repository/commits/'.urlencode($sha).'/comments'), array(
128+
return $this->get($this->getProjectPath($project_id, 'repository/commits/'.rawurlencode($sha).'/comments'), array(
129129
'page' => $page,
130130
'per_page' => $per_page
131131
));
@@ -142,7 +142,7 @@ public function createCommitComment($project_id, $sha, $note, array $params = ar
142142
{
143143
$params['note'] = $note;
144144

145-
return $this->post($this->getProjectPath($project_id, 'repository/commits/'.urlencode($sha).'/comments'), $params);
145+
return $this->post($this->getProjectPath($project_id, 'repository/commits/'.rawurlencode($sha).'/comments'), $params);
146146
}
147147

148148
/**
@@ -155,7 +155,7 @@ public function compare($project_id, $fromShaOrMaster, $toShaOrMaster)
155155
{
156156
return $this->get($this->getProjectPath(
157157
$project_id,
158-
'repository/compare?from='.urlencode($fromShaOrMaster).'&to='.urlencode($toShaOrMaster)
158+
'repository/compare?from='.rawurlencode($fromShaOrMaster).'&to='.rawurlencode($toShaOrMaster)
159159
));
160160
}
161161

@@ -166,7 +166,7 @@ public function compare($project_id, $fromShaOrMaster, $toShaOrMaster)
166166
*/
167167
public function diff($project_id, $sha)
168168
{
169-
return $this->get($this->getProjectPath($project_id, 'repository/commits/'.urlencode($sha).'/diff'));
169+
return $this->get($this->getProjectPath($project_id, 'repository/commits/'.rawurlencode($sha).'/diff'));
170170
}
171171

172172
/**
@@ -187,7 +187,7 @@ public function tree($project_id, array $params = array())
187187
*/
188188
public function blob($project_id, $sha, $filepath)
189189
{
190-
return $this->get($this->getProjectPath($project_id, 'repository/commits/'.urlencode($sha).'/blob'), array(
190+
return $this->get($this->getProjectPath($project_id, 'repository/commits/'.rawurlencode($sha).'/blob'), array(
191191
'filepath' => $filepath
192192
));
193193
}

lib/Gitlab/Api/Snippets.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function all($project_id)
1818
*/
1919
public function show($project_id, $snippet_id)
2020
{
21-
return $this->get($this->getProjectPath($project_id, 'snippets/'.urlencode($snippet_id)));
21+
return $this->get($this->getProjectPath($project_id, 'snippets/'.rawurlencode($snippet_id)));
2222
}
2323

2424
/**
@@ -45,7 +45,7 @@ public function create($project_id, $title, $filename, $code)
4545
*/
4646
public function update($project_id, $snippet_id, array $params)
4747
{
48-
return $this->put($this->getProjectPath($project_id, 'snippets/'.urlencode($snippet_id)), $params);
48+
return $this->put($this->getProjectPath($project_id, 'snippets/'.rawurlencode($snippet_id)), $params);
4949
}
5050

5151
/**
@@ -55,7 +55,7 @@ public function update($project_id, $snippet_id, array $params)
5555
*/
5656
public function content($project_id, $snippet_id)
5757
{
58-
return $this->get($this->getProjectPath($project_id, 'snippets/'.urlencode($snippet_id).'/raw'));
58+
return $this->get($this->getProjectPath($project_id, 'snippets/'.rawurlencode($snippet_id).'/raw'));
5959
}
6060

6161
/**
@@ -65,6 +65,6 @@ public function content($project_id, $snippet_id)
6565
*/
6666
public function remove($project_id, $snippet_id)
6767
{
68-
return $this->delete($this->getProjectPath($project_id, 'snippets/'.urlencode($snippet_id)));
68+
return $this->delete($this->getProjectPath($project_id, 'snippets/'.rawurlencode($snippet_id)));
6969
}
7070
}

lib/Gitlab/Api/SystemHooks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function create($url)
2727
*/
2828
public function test($id)
2929
{
30-
return $this->get('hooks/'.urlencode($id));
30+
return $this->get('hooks/'.rawurlencode($id));
3131
}
3232

3333
/**
@@ -36,6 +36,6 @@ public function test($id)
3636
*/
3737
public function remove($id)
3838
{
39-
return $this->delete('hooks/'.urlencode($id));
39+
return $this->delete('hooks/'.rawurlencode($id));
4040
}
4141
}

0 commit comments

Comments
 (0)