diff --git a/lib/Github/Api/Authorizations.php b/lib/Github/Api/Authorizations.php index 6d45c23f14d..0066a1f0f3f 100644 --- a/lib/Github/Api/Authorizations.php +++ b/lib/Github/Api/Authorizations.php @@ -18,7 +18,7 @@ public function all() public function show($number) { - return $this->get('authorizations/'.urlencode($number)); + return $this->get('authorizations/'.rawurlencode($number)); } public function create(array $params) @@ -28,16 +28,16 @@ public function create(array $params) public function update($id, array $params) { - return $this->patch('authorizations/'.urlencode($id), $params); + return $this->patch('authorizations/'.rawurlencode($id), $params); } public function remove($id) { - return $this->delete('authorizations/'.urlencode($id)); + return $this->delete('authorizations/'.rawurlencode($id)); } public function check($id, $token) { - return $this->get('authorizations/'.urlencode($id).'/tokens/'.urlencode($token)); + return $this->get('authorizations/'.rawurlencode($id).'/tokens/'.rawurlencode($token)); } } diff --git a/lib/Github/Api/CurrentUser/DeployKeys.php b/lib/Github/Api/CurrentUser/DeployKeys.php index 75f64e8e9f4..87a0eaed843 100644 --- a/lib/Github/Api/CurrentUser/DeployKeys.php +++ b/lib/Github/Api/CurrentUser/DeployKeys.php @@ -31,7 +31,7 @@ public function all() */ public function show($id) { - return $this->get('user/keys/'.urlencode($id)); + return $this->get('user/keys/'.rawurlencode($id)); } /** @@ -68,7 +68,7 @@ public function update($id, array $params) throw new MissingArgumentException(array('title', 'key')); } - return $this->patch('user/keys/'.urlencode($id), $params); + return $this->patch('user/keys/'.rawurlencode($id), $params); } /** @@ -80,6 +80,6 @@ public function update($id, array $params) */ public function remove($id) { - return $this->delete('user/keys/'.urlencode($id)); + return $this->delete('user/keys/'.rawurlencode($id)); } } diff --git a/lib/Github/Api/CurrentUser/Followers.php b/lib/Github/Api/CurrentUser/Followers.php index 022df3374f8..ea356d85e32 100644 --- a/lib/Github/Api/CurrentUser/Followers.php +++ b/lib/Github/Api/CurrentUser/Followers.php @@ -33,7 +33,7 @@ public function all($page = 1) */ public function check($username) { - return $this->get('user/following/'.urlencode($username)); + return $this->get('user/following/'.rawurlencode($username)); } /** @@ -45,7 +45,7 @@ public function check($username) */ public function follow($username) { - return $this->put('user/following/'.urlencode($username)); + return $this->put('user/following/'.rawurlencode($username)); } /** @@ -57,6 +57,6 @@ public function follow($username) */ public function unfollow($username) { - return $this->delete('user/following/'.urlencode($username)); + return $this->delete('user/following/'.rawurlencode($username)); } } diff --git a/lib/Github/Api/CurrentUser/Notifications.php b/lib/Github/Api/CurrentUser/Notifications.php index 40d37a50bf8..a35519df783 100644 --- a/lib/Github/Api/CurrentUser/Notifications.php +++ b/lib/Github/Api/CurrentUser/Notifications.php @@ -33,7 +33,7 @@ public function all(array $params = array()) */ public function allInRepository($username, $repository, array $params = array()) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/notifications', $params); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params); } /** @@ -57,7 +57,7 @@ public function markAsReadAll(array $params = array()) */ public function markAsReadInRepository($username, $repository, array $params = array()) { - return $this->put('repos/'.urlencode($username).'/'.urlencode($repository).'/notifications', $params); + return $this->put('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params); } /** @@ -69,7 +69,7 @@ public function markAsReadInRepository($username, $repository, array $params = a */ public function markAsRead($id, array $params) { - return $this->patch('notifications/threads/'.urlencode($id), $params); + return $this->patch('notifications/threads/'.rawurlencode($id), $params); } /** @@ -80,7 +80,7 @@ public function markAsRead($id, array $params) */ public function show($id) { - return $this->get('notifications/threads/'.urlencode($id)); + return $this->get('notifications/threads/'.rawurlencode($id)); } /** @@ -91,7 +91,7 @@ public function show($id) */ public function showSubscription($id) { - return $this->get('notifications/threads/'.urlencode($id).'/subscription'); + return $this->get('notifications/threads/'.rawurlencode($id).'/subscription'); } /** @@ -103,7 +103,7 @@ public function showSubscription($id) */ public function createSubscription($id, array $params) { - return $this->put('notifications/threads/'.urlencode($id).'/subscription', $params); + return $this->put('notifications/threads/'.rawurlencode($id).'/subscription', $params); } /** @@ -114,6 +114,6 @@ public function createSubscription($id, array $params) */ public function removeSubscription($id) { - return $this->delete('notifications/threads/'.urlencode($id).'/subscription'); + return $this->delete('notifications/threads/'.rawurlencode($id).'/subscription'); } } diff --git a/lib/Github/Api/CurrentUser/Watchers.php b/lib/Github/Api/CurrentUser/Watchers.php index 7a752c0b90d..398ac58536a 100644 --- a/lib/Github/Api/CurrentUser/Watchers.php +++ b/lib/Github/Api/CurrentUser/Watchers.php @@ -34,7 +34,7 @@ public function all($page = 1) */ public function check($username, $repository) { - return $this->get('user/watched/'.urlencode($username).'/'.urlencode($repository)); + return $this->get('user/watched/'.rawurlencode($username).'/'.rawurlencode($repository)); } /** @@ -47,7 +47,7 @@ public function check($username, $repository) */ public function watch($username, $repository) { - return $this->put('user/watched/'.urlencode($username).'/'.urlencode($repository)); + return $this->put('user/watched/'.rawurlencode($username).'/'.rawurlencode($repository)); } /** @@ -60,6 +60,6 @@ public function watch($username, $repository) */ public function unwatch($username, $repository) { - return $this->delete('user/watched/'.urlencode($username).'/'.urlencode($repository)); + return $this->delete('user/watched/'.rawurlencode($username).'/'.rawurlencode($repository)); } } diff --git a/lib/Github/Api/Gists.php b/lib/Github/Api/Gists.php index b0a59960094..7514d99e6ff 100644 --- a/lib/Github/Api/Gists.php +++ b/lib/Github/Api/Gists.php @@ -20,12 +20,12 @@ public function all($type = null) return $this->get('gists'); } - return $this->get('gists/'.urlencode($type)); + return $this->get('gists/'.rawurlencode($type)); } public function show($number) { - return $this->get('gists/'.urlencode($number)); + return $this->get('gists/'.rawurlencode($number)); } public function create(array $params) @@ -41,31 +41,31 @@ public function create(array $params) public function update($id, array $params) { - return $this->patch('gists/'.urlencode($id), $params); + return $this->patch('gists/'.rawurlencode($id), $params); } public function fork($id) { - return $this->post('gists/'.urlencode($id).'/fork'); + return $this->post('gists/'.rawurlencode($id).'/fork'); } public function remove($id) { - return $this->delete('gists/'.urlencode($id)); + return $this->delete('gists/'.rawurlencode($id)); } public function check($id) { - return $this->get('gists/'.urlencode($id).'/star'); + return $this->get('gists/'.rawurlencode($id).'/star'); } public function star($id) { - return $this->put('gists/'.urlencode($id).'/star'); + return $this->put('gists/'.rawurlencode($id).'/star'); } public function unstar($id) { - return $this->delete('gists/'.urlencode($id).'/star'); + return $this->delete('gists/'.rawurlencode($id).'/star'); } } diff --git a/lib/Github/Api/GitData/Blobs.php b/lib/Github/Api/GitData/Blobs.php index ee1c3df5137..ce2407b472d 100644 --- a/lib/Github/Api/GitData/Blobs.php +++ b/lib/Github/Api/GitData/Blobs.php @@ -22,7 +22,7 @@ public function configure($bodyType = null) public function show($username, $repository, $sha) { - $response = $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/blobs/'.urlencode($sha)); + $response = $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs/'.rawurlencode($sha)); return $response; } @@ -33,6 +33,6 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('content', 'encoding')); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/git/blobs', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs', $params); } } diff --git a/lib/Github/Api/GitData/Commits.php b/lib/Github/Api/GitData/Commits.php index 8aaefe3ddf4..ab6a07ecff5 100644 --- a/lib/Github/Api/GitData/Commits.php +++ b/lib/Github/Api/GitData/Commits.php @@ -13,7 +13,7 @@ class Commits extends AbstractApi { public function show($username, $repository, $sha) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/commits/'.urlencode($sha)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha)); } public function create($username, $repository, array $params) @@ -22,6 +22,6 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('message', 'tree', 'parents')); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/git/commits', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/commits', $params); } } diff --git a/lib/Github/Api/GitData/References.php b/lib/Github/Api/GitData/References.php index 89886084660..70d8fa37afa 100644 --- a/lib/Github/Api/GitData/References.php +++ b/lib/Github/Api/GitData/References.php @@ -13,22 +13,22 @@ class References extends AbstractApi { public function all($username, $repository) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs'); } public function branches($username, $repository) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs/heads'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/heads'); } public function tags($username, $repository) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs/tags'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/tags'); } public function show($username, $repository, $reference) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs/'.urlencode($reference)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.rawurlencode($reference)); } public function create($username, $repository, array $params) @@ -37,7 +37,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('ref', 'sha')); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs', $params); } public function update($username, $repository, $reference, array $params) @@ -46,11 +46,11 @@ public function update($username, $repository, $reference, array $params) throw new MissingArgumentException('sha'); } - return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs/'.urlencode($reference), $params); + return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.rawurlencode($reference), $params); } public function remove($username, $repository, $reference) { - return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs/'.urlencode($reference)); + return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.rawurlencode($reference)); } } diff --git a/lib/Github/Api/GitData/Tags.php b/lib/Github/Api/GitData/Tags.php index 376a6d6ee4f..b27dddd12f4 100644 --- a/lib/Github/Api/GitData/Tags.php +++ b/lib/Github/Api/GitData/Tags.php @@ -13,12 +13,12 @@ class Tags extends AbstractApi { public function all($username, $repository) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs/tags'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/tags'); } public function show($username, $repository, $sha) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/tags/'.urlencode($sha)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/tags/'.rawurlencode($sha)); } public function create($username, $repository, array $params) @@ -35,6 +35,6 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('tagger.name', 'tagger.email', 'tagger.date')); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/git/tags', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/tags', $params); } } diff --git a/lib/Github/Api/GitData/Trees.php b/lib/Github/Api/GitData/Trees.php index daf487cc1d6..92bd21ac433 100644 --- a/lib/Github/Api/GitData/Trees.php +++ b/lib/Github/Api/GitData/Trees.php @@ -13,7 +13,7 @@ class Trees extends AbstractApi { public function show($username, $repository, $sha, $recursive = false) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/trees/'.urlencode($sha), array('recursive' => $recursive ? 1 : null)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees/'.rawurlencode($sha), array('recursive' => $recursive ? 1 : null)); } public function create($username, $repository, array $params) @@ -37,6 +37,6 @@ public function create($username, $repository, array $params) } } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/git/trees', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees', $params); } } diff --git a/lib/Github/Api/Issue.php b/lib/Github/Api/Issue.php index 918eb478138..c4aae96e994 100644 --- a/lib/Github/Api/Issue.php +++ b/lib/Github/Api/Issue.php @@ -28,7 +28,7 @@ class Issue extends AbstractApi */ public function all($username, $repository, array $params = array()) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/issues', array_merge(array('page' => 1), $params)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues', array_merge(array('page' => 1), $params)); } /** @@ -48,7 +48,7 @@ public function find($username, $repository, $state, $keyword) $state = 'open'; } - return $this->get('legacy/issues/search/'.urlencode($username).'/'.urlencode($repository).'/'.urlencode($state).'/'.urlencode($keyword)); + return $this->get('legacy/issues/search/'.rawurlencode($username).'/'.rawurlencode($repository).'/'.rawurlencode($state).'/'.rawurlencode($keyword)); } /** @@ -66,7 +66,7 @@ public function org($organization, $state, array $params = array()) $state = 'open'; } - return $this->get('orgs/'.urlencode($organization).'/issues', array_merge(array('page' => 1, 'state' => $state), $params)); + return $this->get('orgs/'.rawurlencode($organization).'/issues', array_merge(array('page' => 1, 'state' => $state), $params)); } /** @@ -80,7 +80,7 @@ public function org($organization, $state, array $params = array()) */ public function show($username, $repository, $id) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/'.urlencode($id)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id)); } /** @@ -101,7 +101,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('title', 'body')); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/issues', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues', $params); } /** @@ -117,7 +117,7 @@ public function create($username, $repository, array $params) */ public function update($username, $repository, $id, array $params) { - return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/'.urlencode($id), $params); + return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id), $params); } /** diff --git a/lib/Github/Api/Issue/Comments.php b/lib/Github/Api/Issue/Comments.php index f8fceb8d57e..ae6370fc660 100644 --- a/lib/Github/Api/Issue/Comments.php +++ b/lib/Github/Api/Issue/Comments.php @@ -35,14 +35,14 @@ public function configure($bodyType = null) public function all($username, $repository, $issue, $page = 1) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/'.urlencode($issue).'/comments', array( + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/comments', array( 'page' => $page )); } public function show($username, $repository, $comment) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/comments/'.urlencode($comment)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment)); } public function create($username, $repository, $issue, array $params) @@ -51,7 +51,7 @@ public function create($username, $repository, $issue, array $params) throw new MissingArgumentException('body'); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/'.urlencode($issue).'/comments', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/comments', $params); } public function update($username, $repository, $comment, array $params) @@ -60,11 +60,11 @@ public function update($username, $repository, $comment, array $params) throw new MissingArgumentException('body'); } - return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/comments/'.urlencode($comment), $params); + return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment), $params); } public function remove($username, $repository, $comment) { - return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/comments/'.urlencode($comment)); + return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment)); } } diff --git a/lib/Github/Api/Issue/Events.php b/lib/Github/Api/Issue/Events.php index 726185466bb..17bcef83921 100644 --- a/lib/Github/Api/Issue/Events.php +++ b/lib/Github/Api/Issue/Events.php @@ -13,18 +13,18 @@ class Events extends AbstractApi public function all($username, $repository, $issue = null, $page = 1) { if (null !== $issue) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/'.urlencode($issue).'/events', array( + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/events', array( 'page' => $page )); } - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/events', array( + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/events', array( 'page' => $page )); } public function show($username, $repository, $event) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/events/'.urlencode($event)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/events/'.rawurlencode($event)); } } diff --git a/lib/Github/Api/Issue/Labels.php b/lib/Github/Api/Issue/Labels.php index ccb81b768cb..5628201f50c 100644 --- a/lib/Github/Api/Issue/Labels.php +++ b/lib/Github/Api/Issue/Labels.php @@ -14,10 +14,10 @@ class Labels extends AbstractApi public function all($username, $repository, $issue = null) { if ($issue === null) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/labels'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels'); } - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/'.urlencode($issue).'/labels'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels'); } public function create($username, $repository, array $params) @@ -29,7 +29,7 @@ public function create($username, $repository, array $params) $params['color'] = 'FFFFFF'; } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/labels', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels', $params); } public function add($username, $repository, $issue, $labels) @@ -40,21 +40,21 @@ public function add($username, $repository, $issue, $labels) throw new InvalidArgumentException(); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/'.urlencode($issue).'/labels', $labels); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels', $labels); } public function replace($username, $repository, $issue, array $params) { - return $this->put('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/'.urlencode($issue).'/labels', $params); + return $this->put('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels', $params); } public function remove($username, $repository, $issue, $label) { - return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/'.urlencode($issue).'/labels/'.urlencode($label)); + return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels/'.rawurlencode($label)); } public function clear($username, $repository, $issue) { - return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/issues/'.urlencode($issue).'/labels'); + return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels'); } } diff --git a/lib/Github/Api/Issue/Milestones.php b/lib/Github/Api/Issue/Milestones.php index e19cbc0d391..c13c4aebb2b 100644 --- a/lib/Github/Api/Issue/Milestones.php +++ b/lib/Github/Api/Issue/Milestones.php @@ -23,12 +23,12 @@ public function all($username, $repository, array $params = array()) $params['direction'] = 'desc'; } - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/milestones', array_merge(array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc'), $params)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', array_merge(array('page' => 1, 'state' => 'open', 'sort' => 'due_date', 'direction' => 'desc'), $params)); } public function show($username, $repository, $id) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/milestones/'.urlencode($id)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id)); } public function create($username, $repository, array $params) @@ -40,7 +40,7 @@ public function create($username, $repository, array $params) $params['state'] = 'open'; } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/milestones', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', $params); } public function update($username, $repository, $milestone, array $params) @@ -49,16 +49,16 @@ public function update($username, $repository, $milestone, array $params) $params['state'] = 'open'; } - return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/milestones/'.urlencode($milestone), $params); + return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($milestone), $params); } public function remove($username, $repository, $milestone) { - return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/milestones/'.urlencode($milestone)); + return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($milestone)); } public function labels($username, $repository, $milestone) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/milestones/'.urlencode($milestone).'/labels'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($milestone).'/labels'); } } diff --git a/lib/Github/Api/Organization.php b/lib/Github/Api/Organization.php index 0a1af06b8d4..da46badcfcd 100644 --- a/lib/Github/Api/Organization.php +++ b/lib/Github/Api/Organization.php @@ -24,12 +24,12 @@ class Organization extends AbstractApi */ public function show($organization) { - return $this->get('orgs/'.urlencode($organization)); + return $this->get('orgs/'.rawurlencode($organization)); } public function update($organization, array $params) { - return $this->patch('orgs/'.urlencode($organization), $params); + return $this->patch('orgs/'.rawurlencode($organization), $params); } /** @@ -43,7 +43,7 @@ public function update($organization, array $params) */ public function repositories($organization, $type = 'all') { - return $this->get('orgs/'.urlencode($organization).'/repos', array( + return $this->get('orgs/'.rawurlencode($organization).'/repos', array( 'type' => $type )); } diff --git a/lib/Github/Api/Organization/Members.php b/lib/Github/Api/Organization/Members.php index 7aa9e29bf1b..691f11c335c 100644 --- a/lib/Github/Api/Organization/Members.php +++ b/lib/Github/Api/Organization/Members.php @@ -13,34 +13,34 @@ class Members extends AbstractApi public function all($organization, $type = null) { if (null === $type) { - return $this->get('orgs/'.urlencode($organization).'/members'); + return $this->get('orgs/'.rawurlencode($organization).'/members'); } - return $this->get('orgs/'.urlencode($organization).'/public_members'); + return $this->get('orgs/'.rawurlencode($organization).'/public_members'); } public function show($organization, $username) { - return $this->get('orgs/'.urlencode($organization).'/members/'.urlencode($username)); + return $this->get('orgs/'.rawurlencode($organization).'/members/'.rawurlencode($username)); } public function check($organization, $username) { - return $this->get('orgs/'.urlencode($organization).'/public_members/'.urlencode($username)); + return $this->get('orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username)); } public function publicize($organization, $username) { - return $this->put('orgs/'.urlencode($organization).'/public_members/'.urlencode($username)); + return $this->put('orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username)); } public function conceal($organization, $username) { - return $this->delete('orgs/'.urlencode($organization).'/public_members/'.urlencode($username)); + return $this->delete('orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username)); } public function remove($organization, $username) { - return $this->delete('orgs/'.urlencode($organization).'/members/'.urlencode($username)); + return $this->delete('orgs/'.rawurlencode($organization).'/members/'.rawurlencode($username)); } } diff --git a/lib/Github/Api/Organization/Teams.php b/lib/Github/Api/Organization/Teams.php index 3f231c13eaa..5cdf876db74 100644 --- a/lib/Github/Api/Organization/Teams.php +++ b/lib/Github/Api/Organization/Teams.php @@ -13,7 +13,7 @@ class Teams extends AbstractApi { public function all($organization) { - return $this->get('orgs/'.urlencode($organization).'/teams'); + return $this->get('orgs/'.rawurlencode($organization).'/teams'); } public function create($organization, array $params) @@ -28,12 +28,12 @@ public function create($organization, array $params) $params['permission'] = 'pull'; } - return $this->post('orgs/'.urlencode($organization).'/teams', $params); + return $this->post('orgs/'.rawurlencode($organization).'/teams', $params); } public function show($team) { - return $this->get('teams/'.urlencode($team)); + return $this->get('teams/'.rawurlencode($team)); } public function update($team, array $params) @@ -45,51 +45,51 @@ public function update($team, array $params) $params['permission'] = 'pull'; } - return $this->patch('teams/'.urlencode($team), $params); + return $this->patch('teams/'.rawurlencode($team), $params); } public function remove($team) { - return $this->delete('teams/'.urlencode($team)); + return $this->delete('teams/'.rawurlencode($team)); } public function members($team) { - return $this->get('teams/'.urlencode($team).'/members'); + return $this->get('teams/'.rawurlencode($team).'/members'); } public function check($team, $username) { - return $this->get('teams/'.urlencode($team).'/members/'.urlencode($username)); + return $this->get('teams/'.rawurlencode($team).'/members/'.rawurlencode($username)); } public function addMember($team, $username) { - return $this->put('teams/'.urlencode($team).'/members/'.urlencode($username)); + return $this->put('teams/'.rawurlencode($team).'/members/'.rawurlencode($username)); } public function removeMember($team, $username) { - return $this->delete('teams/'.urlencode($team).'/members/'.urlencode($username)); + return $this->delete('teams/'.rawurlencode($team).'/members/'.rawurlencode($username)); } public function repositories($team) { - return $this->get('teams/'.urlencode($team).'/repos'); + return $this->get('teams/'.rawurlencode($team).'/repos'); } public function repository($team, $username, $repository) { - return $this->get('teams/'.urlencode($team).'/repos/'.urlencode($username).'/'.urlencode($repository)); + return $this->get('teams/'.rawurlencode($team).'/repos/'.rawurlencode($username).'/'.rawurlencode($repository)); } public function addRepository($team, $username, $repository) { - return $this->put('teams/'.urlencode($team).'/repos/'.urlencode($username).'/'.urlencode($repository)); + return $this->put('teams/'.rawurlencode($team).'/repos/'.rawurlencode($username).'/'.rawurlencode($repository)); } public function removeRepository($team, $username, $repository) { - return $this->delete('teams/'.urlencode($team).'/repos/'.urlencode($username).'/'.urlencode($repository)); + return $this->delete('teams/'.rawurlencode($team).'/repos/'.rawurlencode($username).'/'.rawurlencode($repository)); } } diff --git a/lib/Github/Api/PullRequest.php b/lib/Github/Api/PullRequest.php index 4f2170fe09d..e52815cf01a 100644 --- a/lib/Github/Api/PullRequest.php +++ b/lib/Github/Api/PullRequest.php @@ -34,7 +34,7 @@ public function all($username, $repository, $state = null, $page = 1, $perPage = 'state' => $state, ); - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls', $parameters); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $parameters); } /** @@ -49,17 +49,17 @@ public function all($username, $repository, $state = null, $page = 1, $perPage = */ public function show($username, $repository, $id) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/'.urlencode($id)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id)); } public function commits($username, $repository, $id) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/'.urlencode($id).'/commits'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/commits'); } public function files($username, $repository, $id) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/'.urlencode($id).'/files'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/files'); } public function comments() @@ -99,7 +99,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('issue', 'body')); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $params); } public function update($username, $repository, $id, array $params) @@ -108,17 +108,17 @@ public function update($username, $repository, $id, array $params) $params['state'] = 'open'; } - return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/'.urlencode($id), $params); + return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id), $params); } public function merged($username, $repository, $id) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/'.urlencode($id).'/merge'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/merge'); } public function merge($username, $repository, $id, $message = null) { - return $this->put('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/'.urlencode($id).'/merge', array( + return $this->put('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/merge', array( 'commit_message' => $message )); } diff --git a/lib/Github/Api/PullRequest/Comments.php b/lib/Github/Api/PullRequest/Comments.php index 0263e9c8943..dec30fb0566 100644 --- a/lib/Github/Api/PullRequest/Comments.php +++ b/lib/Github/Api/PullRequest/Comments.php @@ -13,12 +13,12 @@ class Comments extends AbstractApi { public function all($username, $repository, $pullRequest) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/'.urlencode($pullRequest).'/comments'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/comments'); } public function show($username, $repository, $comment) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/comments/'.urlencode($comment)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment)); } public function create($username, $repository, $pullRequest, array $params) @@ -32,7 +32,7 @@ public function create($username, $repository, $pullRequest, array $params) throw new MissingArgumentException(array('commit_id', 'path', 'position')); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/'.urlencode($pullRequest).'/comments', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/comments', $params); } public function update($username, $repository, $comment, array $params) @@ -41,11 +41,11 @@ public function update($username, $repository, $comment, array $params) throw new MissingArgumentException('body'); } - return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/comments/'.urlencode($comment), $params); + return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment), $params); } public function remove($username, $repository, $comment) { - return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/pulls/comments/'.urlencode($comment)); + return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment)); } } diff --git a/lib/Github/Api/Repo.php b/lib/Github/Api/Repo.php index 711af9e5cd2..cd5a400ea6c 100644 --- a/lib/Github/Api/Repo.php +++ b/lib/Github/Api/Repo.php @@ -34,7 +34,7 @@ class Repo extends AbstractApi */ public function find($keyword, array $params) { - return $this->get('legacy/repos/search/'.urlencode($keyword), array_merge(array('start_page' => 1), $params)); + return $this->get('legacy/repos/search/'.rawurlencode($keyword), array_merge(array('start_page' => 1), $params)); } /** @@ -62,7 +62,7 @@ public function org($organization, array $params = array()) */ public function show($username, $repository) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository)); } /** @@ -126,7 +126,7 @@ public function create( */ public function update($username, $repository, array $values) { - return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository), $values); + return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository), $values); } /** @@ -140,7 +140,7 @@ public function update($username, $repository, array $values) */ public function remove($username, $repository) { - return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository)); + return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository)); } /** @@ -265,9 +265,9 @@ public function statuses() */ public function branches($username, $repository, $branch = null) { - $url = 'repos/'.urlencode($username).'/'.urlencode($repository).'/branches'; + $url = 'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches'; if (null !== $branch) { - $url .= '/'.urlencode($branch); + $url .= '/'.rawurlencode($branch); } return $this->get($url); @@ -285,7 +285,7 @@ public function branches($username, $repository, $branch = null) */ public function contributors($username, $repository, $includingAnonymous = false) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/contributors', array( + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contributors', array( 'anon' => $includingAnonymous ?: null )); } @@ -301,7 +301,7 @@ public function contributors($username, $repository, $includingAnonymous = false */ public function languages($username, $repository) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/languages'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/languages'); } /** @@ -315,7 +315,7 @@ public function languages($username, $repository) */ public function tags($username, $repository) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/tags'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/tags'); } /** @@ -329,7 +329,7 @@ public function tags($username, $repository) */ public function teams($username, $repository) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/teams'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/teams'); } /** @@ -341,7 +341,7 @@ public function teams($username, $repository) */ public function watchers($username, $repository, $page = 1) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/watchers', array( + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/watchers', array( 'page' => $page )); } @@ -360,7 +360,7 @@ public function watchers($username, $repository, $page = 1) */ public function merge($username, $repository, $base, $head, $message = null) { - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/merges', array( + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/merges', array( 'base' => $base, 'head' => $head, 'commit_message' => $message diff --git a/lib/Github/Api/Repository/Collaborators.php b/lib/Github/Api/Repository/Collaborators.php index 987a148d167..89a95068559 100644 --- a/lib/Github/Api/Repository/Collaborators.php +++ b/lib/Github/Api/Repository/Collaborators.php @@ -12,21 +12,21 @@ class Collaborators extends AbstractApi { public function all($username, $repository) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/collaborators'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators'); } public function check($username, $repository, $collaborator) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/collaborators/'.urlencode($collaborator)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator)); } public function add($username, $repository, $collaborator) { - return $this->put('repos/'.urlencode($username).'/'.urlencode($repository).'/collaborators/'.urlencode($collaborator)); + return $this->put('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator)); } public function remove($username, $repository, $collaborator) { - return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/collaborators/'.urlencode($collaborator)); + return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator)); } } diff --git a/lib/Github/Api/Repository/Comments.php b/lib/Github/Api/Repository/Comments.php index 29119f389d5..cce0e5059d6 100644 --- a/lib/Github/Api/Repository/Comments.php +++ b/lib/Github/Api/Repository/Comments.php @@ -36,15 +36,15 @@ public function configure($bodyType = null) public function all($username, $repository, $sha = null) { if (null === $sha) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/comments'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments'); } - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/commits/'.urlencode($sha).'/comments'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/comments'); } public function show($username, $repository, $comment) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/comments/'.urlencode($comment)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment)); } public function create($username, $repository, $sha, array $params) @@ -53,7 +53,7 @@ public function create($username, $repository, $sha, array $params) throw new MissingArgumentException('body'); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/commits/'.urlencode($sha).'/comments', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/comments', $params); } public function update($username, $repository, $comment, array $params) @@ -62,11 +62,11 @@ public function update($username, $repository, $comment, array $params) throw new MissingArgumentException('body'); } - return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/comments/'.urlencode($comment), $params); + return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment), $params); } public function remove($username, $repository, $comment) { - return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/comments/'.urlencode($comment)); + return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment)); } } diff --git a/lib/Github/Api/Repository/Commits.php b/lib/Github/Api/Repository/Commits.php index 030231e0b1c..9c8726bd3b8 100644 --- a/lib/Github/Api/Repository/Commits.php +++ b/lib/Github/Api/Repository/Commits.php @@ -12,16 +12,16 @@ class Commits extends AbstractApi { public function all($username, $repository, array $params) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/commits', $params); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits', $params); } public function compare($username, $repository, $base, $head) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/compare/'.urlencode($base).'...'.urlencode($head)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/compare/'.rawurlencode($base).'...'.rawurlencode($head)); } public function show($username, $repository, $sha) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/commits/'.urlencode($sha)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha)); } } diff --git a/lib/Github/Api/Repository/Contents.php b/lib/Github/Api/Repository/Contents.php index 6a79377654f..47ce7a462e8 100644 --- a/lib/Github/Api/Repository/Contents.php +++ b/lib/Github/Api/Repository/Contents.php @@ -24,7 +24,7 @@ class Contents extends AbstractApi */ public function readme($username, $repository, $reference = null) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/readme', array( + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', array( 'ref' => $reference )); } @@ -42,9 +42,9 @@ public function readme($username, $repository, $reference = null) */ public function show($username, $repository, $path = null, $reference = null) { - $url = 'repos/'.urlencode($username).'/'.urlencode($repository).'/contents'; + $url = 'repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents'; if (null !== $path) { - $url .= '/'.urlencode($path); + $url .= '/'.rawurlencode($path); } return $this->get($url, array( @@ -69,7 +69,7 @@ public function archive($username, $repository, $format, $reference = null) $format = 'tarball'; } - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/'.urlencode($format), array( + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/'.rawurlencode($format), array( 'ref' => $reference )); } diff --git a/lib/Github/Api/Repository/DeployKeys.php b/lib/Github/Api/Repository/DeployKeys.php index b25b1d04780..390835798ac 100644 --- a/lib/Github/Api/Repository/DeployKeys.php +++ b/lib/Github/Api/Repository/DeployKeys.php @@ -13,12 +13,12 @@ class DeployKeys extends AbstractApi { public function all($username, $repository) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/keys'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys'); } public function show($username, $repository, $id) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/keys/'.urlencode($id)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id)); } public function create($username, $repository, array $params) @@ -27,7 +27,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('title', 'key')); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/keys', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys', $params); } public function update($username, $repository, $id, array $params) @@ -36,11 +36,11 @@ public function update($username, $repository, $id, array $params) throw new MissingArgumentException(array('title', 'key')); } - return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/keys/'.urlencode($id), $params); + return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id), $params); } public function remove($username, $repository, $id) { - return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/keys/'.urlencode($id)); + return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id)); } } diff --git a/lib/Github/Api/Repository/Downloads.php b/lib/Github/Api/Repository/Downloads.php index e402c317c1d..f3b96891c77 100644 --- a/lib/Github/Api/Repository/Downloads.php +++ b/lib/Github/Api/Repository/Downloads.php @@ -21,7 +21,7 @@ class Downloads extends AbstractApi */ public function all($username, $repository) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/downloads'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads'); } /** @@ -36,7 +36,7 @@ public function all($username, $repository) */ public function show($username, $repository, $id) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/downloads/'.urlencode($id)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads/'.rawurlencode($id)); } /** @@ -51,6 +51,6 @@ public function show($username, $repository, $id) */ public function remove($username, $repository, $id) { - return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/downloads/'.urlencode($id)); + return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads/'.rawurlencode($id)); } } diff --git a/lib/Github/Api/Repository/Forks.php b/lib/Github/Api/Repository/Forks.php index 2a88c330f12..c165961856e 100644 --- a/lib/Github/Api/Repository/Forks.php +++ b/lib/Github/Api/Repository/Forks.php @@ -16,11 +16,11 @@ public function all($username, $repository, array $params = array()) $params['sort'] = 'newest'; } - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/forks', array_merge(array('page' => 1), $params)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/forks', array_merge(array('page' => 1), $params)); } public function create($username, $repository, array $params = array()) { - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/forks', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/forks', $params); } } diff --git a/lib/Github/Api/Repository/Hooks.php b/lib/Github/Api/Repository/Hooks.php index 7c8b696b79d..ad9e8596ecd 100644 --- a/lib/Github/Api/Repository/Hooks.php +++ b/lib/Github/Api/Repository/Hooks.php @@ -13,12 +13,12 @@ class Hooks extends AbstractApi { public function all($username, $repository) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/hooks'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks'); } public function show($username, $repository, $id) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/hooks/'.urlencode($id)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id)); } public function create($username, $repository, array $params) @@ -27,7 +27,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('name', 'config')); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/hooks', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks', $params); } public function update($username, $repository, $id, array $params) @@ -36,16 +36,16 @@ public function update($username, $repository, $id, array $params) throw new MissingArgumentException(array('name', 'config')); } - return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/hooks/'.urlencode($id), $params); + return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id), $params); } public function test($username, $repository, $id) { - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/hooks/'.urlencode($id).'/test'); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id).'/test'); } public function remove($username, $repository, $id) { - return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/hooks/'.urlencode($id)); + return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id)); } } diff --git a/lib/Github/Api/Repository/Labels.php b/lib/Github/Api/Repository/Labels.php index 5ff2305ae7e..e35b4ded71d 100644 --- a/lib/Github/Api/Repository/Labels.php +++ b/lib/Github/Api/Repository/Labels.php @@ -13,12 +13,12 @@ class Labels extends AbstractApi { public function all($username, $repository) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/labels'); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels'); } public function show($username, $repository, $label) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/labels/'.urlencode($label)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label)); } public function create($username, $repository, array $params) @@ -27,7 +27,7 @@ public function create($username, $repository, array $params) throw new MissingArgumentException(array('name', 'color')); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/labels', $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels', $params); } public function update($username, $repository, $label, array $params) @@ -36,11 +36,11 @@ public function update($username, $repository, $label, array $params) throw new MissingArgumentException(array('name', 'color')); } - return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/labels/'.urlencode($label), $params); + return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label), $params); } public function remove($username, $repository, $label) { - return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/labels/'.urlencode($label)); + return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label)); } } diff --git a/lib/Github/Api/Repository/Statuses.php b/lib/Github/Api/Repository/Statuses.php index 9b3e7630ecc..918b2bd4cd6 100644 --- a/lib/Github/Api/Repository/Statuses.php +++ b/lib/Github/Api/Repository/Statuses.php @@ -22,7 +22,7 @@ class Statuses extends AbstractApi */ public function show($username, $repository, $sha) { - return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/statuses/'.urlencode($sha)); + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/statuses/'.rawurlencode($sha)); } /** @@ -43,6 +43,6 @@ public function create($username, $repository, $sha, array $params = array()) throw new MissingArgumentException('state'); } - return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/statuses/'.urlencode($sha), $params); + return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/statuses/'.rawurlencode($sha), $params); } } diff --git a/lib/Github/Api/User.php b/lib/Github/Api/User.php index 6ecb28ca597..97c3be0fda4 100644 --- a/lib/Github/Api/User.php +++ b/lib/Github/Api/User.php @@ -21,7 +21,7 @@ class User extends AbstractApi */ public function find($keyword) { - return $this->get('legacy/user/search/'.urlencode($keyword)); + return $this->get('legacy/user/search/'.rawurlencode($keyword)); } /** @@ -33,7 +33,7 @@ public function find($keyword) */ public function show($username) { - return $this->get('users/'.urlencode($username)); + return $this->get('users/'.rawurlencode($username)); } /** @@ -45,7 +45,7 @@ public function show($username) */ public function following($username) { - return $this->get('users/'.urlencode($username).'/following'); + return $this->get('users/'.rawurlencode($username).'/following'); } /** @@ -57,7 +57,7 @@ public function following($username) */ public function followers($username) { - return $this->get('users/'.urlencode($username).'/followers'); + return $this->get('users/'.rawurlencode($username).'/followers'); } /** @@ -69,7 +69,7 @@ public function followers($username) */ public function watched($username) { - return $this->get('users/'.urlencode($username).'/watched'); + return $this->get('users/'.rawurlencode($username).'/watched'); } /** @@ -81,7 +81,7 @@ public function watched($username) */ public function repositories($username) { - return $this->get('users/'.urlencode($username).'/repos'); + return $this->get('users/'.rawurlencode($username).'/repos'); } /** @@ -93,7 +93,7 @@ public function repositories($username) */ public function gists($username) { - return $this->get('users/'.urlencode($username).'/gists'); + return $this->get('users/'.rawurlencode($username).'/gists'); } /** @@ -105,7 +105,7 @@ public function gists($username) */ public function keys($username) { - return $this->get('users/'.urlencode($username).'/keys'); + return $this->get('users/'.rawurlencode($username).'/keys'); } /** @@ -119,6 +119,6 @@ public function keys($username) */ public function publicEvents($username) { - return $this->get('users/' . urlencode($username) . '/events/public'); + return $this->get('users/'.rawurlencode($username) . '/events/public'); } } diff --git a/test/Github/Tests/Api/IssueTest.php b/test/Github/Tests/Api/IssueTest.php index a2c48d57157..cdd7ba7f3b1 100644 --- a/test/Github/Tests/Api/IssueTest.php +++ b/test/Github/Tests/Api/IssueTest.php @@ -164,7 +164,7 @@ public function shouldSearchOpenIssues() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('legacy/issues/search/KnpLabs/php-github-api/open/Invalid+Commits') + ->with('legacy/issues/search/KnpLabs/php-github-api/open/Invalid%20Commits') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->find('KnpLabs', 'php-github-api', 'open', 'Invalid Commits')); @@ -180,7 +180,7 @@ public function shouldSearchClosedIssues() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('legacy/issues/search/KnpLabs/php-github-api/closed/Invalid+Commits') + ->with('legacy/issues/search/KnpLabs/php-github-api/closed/Invalid%20Commits') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->find('KnpLabs', 'php-github-api', 'closed', 'Invalid Commits')); @@ -196,7 +196,7 @@ public function shouldSearchOpenIssuesWhenStateNotRecognized() $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('legacy/issues/search/KnpLabs/php-github-api/open/Invalid+Commits') + ->with('legacy/issues/search/KnpLabs/php-github-api/open/Invalid%20Commits') ->will($this->returnValue($expectedArray)); $this->assertEquals($expectedArray, $api->find('KnpLabs', 'php-github-api', 'abc', 'Invalid Commits')); diff --git a/test/Github/Tests/Api/Repository/ContentsTest.php b/test/Github/Tests/Api/Repository/ContentsTest.php index e3191af4da2..0eb91a4cd15 100644 --- a/test/Github/Tests/Api/Repository/ContentsTest.php +++ b/test/Github/Tests/Api/Repository/ContentsTest.php @@ -92,7 +92,7 @@ public function shouldFetchZipballArchive() public function shouldDownloadForGivenPath() { // The show() method return - $getValue = include 'ContentsDownloadFixture.php'; + $getValue = include __DIR__.'/fixtures/ContentsDownloadFixture.php'; // The download() method return $expectedValue = base64_decode($getValue['content']); @@ -106,6 +106,26 @@ public function shouldDownloadForGivenPath() $this->assertEquals($expectedValue, $api->download('KnpLabs', 'php-github-api', 'test/Github/Tests/Api/Repository/ContentsTest.php')); } + /** + * @test + */ + public function shouldDownloadForSpacedPath() + { + // The show() method return + $getValue = include __DIR__.'/fixtures/ContentsDownloadSpacedFixture.php'; + + // The download() method return + $expectedValue = base64_decode($getValue['content']); + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('repos/mads379/scala.tmbundle/contents/Syntaxes%2FSimple%20Build%20Tool.tmLanguage', array('ref' => null)) + ->will($this->returnValue($getValue)); + + $this->assertEquals($expectedValue, $api->download('mads379', 'scala.tmbundle', 'Syntaxes/Simple Build Tool.tmLanguage')); + } + protected function getApiClass() { return 'Github\Api\Repository\Contents'; diff --git a/test/Github/Tests/Api/Repository/ContentsDownloadFixture.php b/test/Github/Tests/Api/Repository/fixtures/ContentsDownloadFixture.php similarity index 100% rename from test/Github/Tests/Api/Repository/ContentsDownloadFixture.php rename to test/Github/Tests/Api/Repository/fixtures/ContentsDownloadFixture.php diff --git a/test/Github/Tests/Api/Repository/fixtures/ContentsDownloadSpacedFixture.php b/test/Github/Tests/Api/Repository/fixtures/ContentsDownloadSpacedFixture.php new file mode 100644 index 00000000000..5178659574f --- /dev/null +++ b/test/Github/Tests/Api/Repository/fixtures/ContentsDownloadSpacedFixture.php @@ -0,0 +1,6 @@ +