Skip to content

Commit 4a5dc4b

Browse files
committed
Merge pull request #82 from paolomainardi/PGA-81_change_urlencode_to_rawurlencode
Change `urlencode()` to `rawurlencode()`. Fixes #81
2 parents f41e8d7 + 094952d commit 4a5dc4b

File tree

11 files changed

+64
-64
lines changed

11 files changed

+64
-64
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/Projects.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function owned($page = 1, $per_page = self::PER_PAGE, $order_by = self::O
6060
*/
6161
public function search($query, $page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = self::SORT)
6262
{
63-
return $this->get('projects/search/'.urlencode($query), array(
63+
return $this->get('projects/search/'.rawurlencode($query), array(
6464
'page' => $page,
6565
'per_page' => $per_page,
6666
'order_by' => $order_by,
@@ -74,7 +74,7 @@ public function search($query, $page = 1, $per_page = self::PER_PAGE, $order_by
7474
*/
7575
public function show($project_id)
7676
{
77-
return $this->get('projects/'.urlencode($project_id));
77+
return $this->get('projects/'.rawurlencode($project_id));
7878
}
7979

8080
/**
@@ -99,7 +99,7 @@ public function createForUser($user_id, $name, array $params = array())
9999
{
100100
$params['name'] = $name;
101101

102-
return $this->post('projects/user/'.urlencode($user_id), $params);
102+
return $this->post('projects/user/'.rawurlencode($user_id), $params);
103103
}
104104

105105
/**
@@ -109,7 +109,7 @@ public function createForUser($user_id, $name, array $params = array())
109109
*/
110110
public function update($project_id, array $params)
111111
{
112-
return $this->put('projects/'.urlencode($project_id), $params);
112+
return $this->put('projects/'.rawurlencode($project_id), $params);
113113
}
114114

115115
/**
@@ -118,7 +118,7 @@ public function update($project_id, array $params)
118118
*/
119119
public function remove($project_id)
120120
{
121-
return $this->delete('projects/'.urlencode($project_id));
121+
return $this->delete('projects/'.rawurlencode($project_id));
122122
}
123123

124124
/**
@@ -140,7 +140,7 @@ public function members($project_id, $username_query = null)
140140
*/
141141
public function member($project_id, $user_id)
142142
{
143-
return $this->get($this->getProjectPath($project_id, 'members/'.urlencode($user_id)));
143+
return $this->get($this->getProjectPath($project_id, 'members/'.rawurlencode($user_id)));
144144
}
145145

146146
/**
@@ -201,7 +201,7 @@ public function hooks($project_id, $page = 1, $per_page = self::PER_PAGE)
201201
*/
202202
public function hook($project_id, $hook_id)
203203
{
204-
return $this->get($this->getProjectPath($project_id, 'hooks/'.urlencode($hook_id)));
204+
return $this->get($this->getProjectPath($project_id, 'hooks/'.rawurlencode($hook_id)));
205205
}
206206

207207
/**
@@ -229,7 +229,7 @@ public function addHook($project_id, $url, array $params = array())
229229
*/
230230
public function updateHook($project_id, $hook_id, array $params)
231231
{
232-
return $this->put($this->getProjectPath($project_id, 'hooks/'.urlencode($hook_id)), $params);
232+
return $this->put($this->getProjectPath($project_id, 'hooks/'.rawurlencode($hook_id)), $params);
233233
}
234234

235235
/**
@@ -239,7 +239,7 @@ public function updateHook($project_id, $hook_id, array $params)
239239
*/
240240
public function removeHook($project_id, $hook_id)
241241
{
242-
return $this->delete($this->getProjectPath($project_id, 'hooks/'.urlencode($hook_id)));
242+
return $this->delete($this->getProjectPath($project_id, 'hooks/'.rawurlencode($hook_id)));
243243
}
244244

245245
/**
@@ -258,7 +258,7 @@ public function keys($project_id)
258258
*/
259259
public function key($project_id, $key_id)
260260
{
261-
return $this->get($this->getProjectPath($project_id, 'keys/'.urlencode($key_id)));
261+
return $this->get($this->getProjectPath($project_id, 'keys/'.rawurlencode($key_id)));
262262
}
263263

264264
/**
@@ -282,7 +282,7 @@ public function addKey($project_id, $title, $key)
282282
*/
283283
public function removeKey($project_id, $key_id)
284284
{
285-
return $this->delete($this->getProjectPath($project_id, 'keys/'.urlencode($key_id)));
285+
return $this->delete($this->getProjectPath($project_id, 'keys/'.rawurlencode($key_id)));
286286
}
287287

288288
/**
@@ -342,7 +342,7 @@ public function removeLabel($project_id, $name)
342342
*/
343343
public function createForkRelation($project_id, $forked_project_id)
344344
{
345-
return $this->post($this->getProjectPath($project_id, 'fork/'.urlencode($forked_project_id)));
345+
return $this->post($this->getProjectPath($project_id, 'fork/'.rawurlencode($forked_project_id)));
346346
}
347347

348348
/**
@@ -362,7 +362,7 @@ public function removeForkRelation($project_id)
362362
*/
363363
public function setService($project_id, $service_name, array $params = array())
364364
{
365-
return $this->put($this->getProjectPath($project_id, 'services/'.urlencode($service_name)), $params);
365+
return $this->put($this->getProjectPath($project_id, 'services/'.rawurlencode($service_name)), $params);
366366
}
367367

368368
/**
@@ -372,6 +372,6 @@ public function setService($project_id, $service_name, array $params = array())
372372
*/
373373
public function removeService($project_id, $service_name)
374374
{
375-
return $this->delete($this->getProjectPath($project_id, 'services/'.urlencode($service_name)));
375+
return $this->delete($this->getProjectPath($project_id, 'services/'.rawurlencode($service_name)));
376376
}
377377
}

0 commit comments

Comments
 (0)