Skip to content

refs #81: Change urlencode to rawurlencode #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Gitlab/Api/AbstractApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ protected function delete($path, array $parameters = array(), $requestHeaders =
*/
protected function getProjectPath($id, $path)
{
return 'projects/'.urlencode($id).'/'.$path;
return 'projects/'.rawurlencode($id).'/'.$path;
}
}
16 changes: 8 additions & 8 deletions lib/Gitlab/Api/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function all($page = 1, $per_page = self::PER_PAGE)
*/
public function search($query, $page = 1, $per_page = self::PER_PAGE)
{
return $this->get('groups?search='.urlencode($query), array(
return $this->get('groups?search='.rawurlencode($query), array(
'page' => $page,
'per_page' => $per_page
));
Expand All @@ -35,7 +35,7 @@ public function search($query, $page = 1, $per_page = self::PER_PAGE)
*/
public function show($id)
{
return $this->get('groups/'.urlencode($id));
return $this->get('groups/'.rawurlencode($id));
}

/**
Expand All @@ -59,7 +59,7 @@ public function create($name, $path, $description = null)
*/
public function remove($group_id)
{
return $this->delete('groups/'.urlencode($group_id));
return $this->delete('groups/'.rawurlencode($group_id));
}

/**
Expand All @@ -69,7 +69,7 @@ public function remove($group_id)
*/
public function transfer($group_id, $project_id)
{
return $this->post('groups/'.urlencode($group_id).'/projects/'.urlencode($project_id));
return $this->post('groups/'.rawurlencode($group_id).'/projects/'.rawurlencode($project_id));
}

/**
Expand All @@ -80,7 +80,7 @@ public function transfer($group_id, $project_id)
*/
public function members($id, $page = 1, $per_page = self::PER_PAGE)
{
return $this->get('groups/'.urlencode($id).'/members', array(
return $this->get('groups/'.rawurlencode($id).'/members', array(
'page' => $page,
'per_page' => $per_page
));
Expand All @@ -94,7 +94,7 @@ public function members($id, $page = 1, $per_page = self::PER_PAGE)
*/
public function addMember($group_id, $user_id, $access_level)
{
return $this->post('groups/'.urlencode($group_id).'/members', array(
return $this->post('groups/'.rawurlencode($group_id).'/members', array(
'user_id' => $user_id,
'access_level' => $access_level
));
Expand All @@ -108,7 +108,7 @@ public function addMember($group_id, $user_id, $access_level)
*/
public function saveMember($group_id, $user_id, $access_level)
{
return $this->put('groups/'.urlencode($group_id).'/members/'.urlencode($user_id), array(
return $this->put('groups/'.rawurlencode($group_id).'/members/'.rawurlencode($user_id), array(
'access_level' => $access_level
));
}
Expand All @@ -120,6 +120,6 @@ public function saveMember($group_id, $user_id, $access_level)
*/
public function removeMember($group_id, $user_id)
{
return $this->delete('groups/'.urlencode($group_id).'/members/'.urlencode($user_id));
return $this->delete('groups/'.rawurlencode($group_id).'/members/'.rawurlencode($user_id));
}
}
12 changes: 6 additions & 6 deletions lib/Gitlab/Api/Issues.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function all($project_id = null, $page = 1, $per_page = self::PER_PAGE, a
*/
public function show($project_id, $issue_id)
{
return $this->get($this->getProjectPath($project_id, 'issues/'.urlencode($issue_id)));
return $this->get($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id)));
}

/**
Expand All @@ -50,7 +50,7 @@ public function create($project_id, array $params)
*/
public function update($project_id, $issue_id, array $params)
{
return $this->put($this->getProjectPath($project_id, 'issues/'.urlencode($issue_id)), $params);
return $this->put($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id)), $params);
}

/**
Expand All @@ -60,7 +60,7 @@ public function update($project_id, $issue_id, array $params)
*/
public function showComments($project_id, $issue_id)
{
return $this->get($this->getProjectPath($project_id, 'issues/'.urlencode($issue_id)).'/notes');
return $this->get($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id)).'/notes');
}

/**
Expand All @@ -71,7 +71,7 @@ public function showComments($project_id, $issue_id)
*/
public function showComment($project_id, $issue_id, $note_id)
{
return $this->get($this->getProjectPath($project_id, 'issues/'.urlencode($issue_id)).'/notes/'.urlencode($note_id));
return $this->get($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id)).'/notes/'.rawurlencode($note_id));
}

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

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

/**
Expand All @@ -101,7 +101,7 @@ public function addComment($project_id, $issue_id, $body)
*/
public function updateComment($project_id, $issue_id, $note_id, $body)
{
return $this->put($this->getProjectPath($project_id, 'issues/'.urlencode($issue_id).'/notes/'.urlencode($note_id)), array(
return $this->put($this->getProjectPath($project_id, 'issues/'.rawurlencode($issue_id).'/notes/'.rawurlencode($note_id)), array(
'body' => $body
));
}
Expand Down
12 changes: 6 additions & 6 deletions lib/Gitlab/Api/MergeRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function closed($project_id, $page = 1, $per_page = self::PER_PAGE, $orde
*/
public function show($project_id, $mr_id)
{
return $this->get($this->getProjectPath($project_id, 'merge_request/'.urlencode($mr_id)));
return $this->get($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id)));
}

/**
Expand Down Expand Up @@ -122,7 +122,7 @@ public function create($project_id, $source, $target, $title, $assignee = null,
*/
public function update($project_id, $mr_id, array $params)
{
return $this->put($this->getProjectPath($project_id, 'merge_request/'.urlencode($mr_id)), $params);
return $this->put($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id)), $params);
}

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

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

/**
Expand All @@ -149,7 +149,7 @@ public function merge($project_id, $mr_id, $message = null)
*/
public function showComments($project_id, $mr_id)
{
return $this->get($this->getProjectPath($project_id, 'merge_request/'.urlencode($mr_id).'/comments'));
return $this->get($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id).'/comments'));
}

/**
Expand All @@ -160,7 +160,7 @@ public function showComments($project_id, $mr_id)
*/
public function addComment($project_id, $mr_id, $note)
{
return $this->post($this->getProjectPath($project_id, 'merge_request/'.urlencode($mr_id).'/comments'), array(
return $this->post($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id).'/comments'), array(
'note' => $note
));
}
Expand All @@ -172,6 +172,6 @@ public function addComment($project_id, $mr_id, $note)
*/
public function changes($project_id, $mr_id)
{
return $this->get($this->getProjectPath($project_id, 'merge_request/'.urlencode($mr_id).'/changes'));
return $this->get($this->getProjectPath($project_id, 'merge_request/'.rawurlencode($mr_id).'/changes'));
}
}
6 changes: 3 additions & 3 deletions lib/Gitlab/Api/Milestones.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function all($project_id, $page = 1, $per_page = self::PER_PAGE)
*/
public function show($project_id, $milestone_id)
{
return $this->get($this->getProjectPath($project_id, 'milestones/'.urlencode($milestone_id)));
return $this->get($this->getProjectPath($project_id, 'milestones/'.rawurlencode($milestone_id)));
}

/**
Expand All @@ -44,7 +44,7 @@ public function create($project_id, array $params)
*/
public function update($project_id, $milestone_id, array $params)
{
return $this->put($this->getProjectPath($project_id, 'milestones/'.urlencode($milestone_id)), $params);
return $this->put($this->getProjectPath($project_id, 'milestones/'.rawurlencode($milestone_id)), $params);
}

/**
Expand All @@ -54,6 +54,6 @@ public function update($project_id, $milestone_id, array $params)
*/
public function issues($project_id, $milestone_id)
{
return $this->get($this->getProjectPath($project_id, 'milestones/'.urlencode($milestone_id).'/issues'));
return $this->get($this->getProjectPath($project_id, 'milestones/'.rawurlencode($milestone_id).'/issues'));
}
}
28 changes: 14 additions & 14 deletions lib/Gitlab/Api/Projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function owned($page = 1, $per_page = self::PER_PAGE, $order_by = self::O
*/
public function search($query, $page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = self::SORT)
{
return $this->get('projects/search/'.urlencode($query), array(
return $this->get('projects/search/'.rawurlencode($query), array(
'page' => $page,
'per_page' => $per_page,
'order_by' => $order_by,
Expand All @@ -74,7 +74,7 @@ public function search($query, $page = 1, $per_page = self::PER_PAGE, $order_by
*/
public function show($project_id)
{
return $this->get('projects/'.urlencode($project_id));
return $this->get('projects/'.rawurlencode($project_id));
}

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

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

/**
Expand All @@ -109,7 +109,7 @@ public function createForUser($user_id, $name, array $params = array())
*/
public function update($project_id, array $params)
{
return $this->put('projects/'.urlencode($project_id), $params);
return $this->put('projects/'.rawurlencode($project_id), $params);
}

/**
Expand All @@ -118,7 +118,7 @@ public function update($project_id, array $params)
*/
public function remove($project_id)
{
return $this->delete('projects/'.urlencode($project_id));
return $this->delete('projects/'.rawurlencode($project_id));
}

/**
Expand All @@ -140,7 +140,7 @@ public function members($project_id, $username_query = null)
*/
public function member($project_id, $user_id)
{
return $this->get($this->getProjectPath($project_id, 'members/'.urlencode($user_id)));
return $this->get($this->getProjectPath($project_id, 'members/'.rawurlencode($user_id)));
}

/**
Expand Down Expand Up @@ -201,7 +201,7 @@ public function hooks($project_id, $page = 1, $per_page = self::PER_PAGE)
*/
public function hook($project_id, $hook_id)
{
return $this->get($this->getProjectPath($project_id, 'hooks/'.urlencode($hook_id)));
return $this->get($this->getProjectPath($project_id, 'hooks/'.rawurlencode($hook_id)));
}

/**
Expand Down Expand Up @@ -229,7 +229,7 @@ public function addHook($project_id, $url, array $params = array())
*/
public function updateHook($project_id, $hook_id, array $params)
{
return $this->put($this->getProjectPath($project_id, 'hooks/'.urlencode($hook_id)), $params);
return $this->put($this->getProjectPath($project_id, 'hooks/'.rawurlencode($hook_id)), $params);
}

/**
Expand All @@ -239,7 +239,7 @@ public function updateHook($project_id, $hook_id, array $params)
*/
public function removeHook($project_id, $hook_id)
{
return $this->delete($this->getProjectPath($project_id, 'hooks/'.urlencode($hook_id)));
return $this->delete($this->getProjectPath($project_id, 'hooks/'.rawurlencode($hook_id)));
}

/**
Expand All @@ -258,7 +258,7 @@ public function keys($project_id)
*/
public function key($project_id, $key_id)
{
return $this->get($this->getProjectPath($project_id, 'keys/'.urlencode($key_id)));
return $this->get($this->getProjectPath($project_id, 'keys/'.rawurlencode($key_id)));
}

/**
Expand All @@ -282,7 +282,7 @@ public function addKey($project_id, $title, $key)
*/
public function removeKey($project_id, $key_id)
{
return $this->delete($this->getProjectPath($project_id, 'keys/'.urlencode($key_id)));
return $this->delete($this->getProjectPath($project_id, 'keys/'.rawurlencode($key_id)));
}

/**
Expand Down Expand Up @@ -342,7 +342,7 @@ public function removeLabel($project_id, $name)
*/
public function createForkRelation($project_id, $forked_project_id)
{
return $this->post($this->getProjectPath($project_id, 'fork/'.urlencode($forked_project_id)));
return $this->post($this->getProjectPath($project_id, 'fork/'.rawurlencode($forked_project_id)));
}

/**
Expand All @@ -362,7 +362,7 @@ public function removeForkRelation($project_id)
*/
public function setService($project_id, $service_name, array $params = array())
{
return $this->put($this->getProjectPath($project_id, 'services/'.urlencode($service_name)), $params);
return $this->put($this->getProjectPath($project_id, 'services/'.rawurlencode($service_name)), $params);
}

/**
Expand All @@ -372,6 +372,6 @@ public function setService($project_id, $service_name, array $params = array())
*/
public function removeService($project_id, $service_name)
{
return $this->delete($this->getProjectPath($project_id, 'services/'.urlencode($service_name)));
return $this->delete($this->getProjectPath($project_id, 'services/'.rawurlencode($service_name)));
}
}
Loading