Skip to content

rawurlencode instead of urlencode, fixes #77 #78

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
merged 3 commits into from
Oct 16, 2013
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
8 changes: 4 additions & 4 deletions lib/Github/Api/Authorizations.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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));
}
}
6 changes: 3 additions & 3 deletions lib/Github/Api/CurrentUser/DeployKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -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));
}
}
6 changes: 3 additions & 3 deletions lib/Github/Api/CurrentUser/Followers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand All @@ -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));
}

/**
Expand All @@ -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));
}
}
14 changes: 7 additions & 7 deletions lib/Github/Api/CurrentUser/Notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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));
}

/**
Expand All @@ -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');
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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');
}
}
6 changes: 3 additions & 3 deletions lib/Github/Api/CurrentUser/Watchers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand All @@ -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));
}

/**
Expand All @@ -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));
}
}
16 changes: 8 additions & 8 deletions lib/Github/Api/Gists.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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');
}
}
4 changes: 2 additions & 2 deletions lib/Github/Api/GitData/Blobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
}
}
4 changes: 2 additions & 2 deletions lib/Github/Api/GitData/Commits.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}
}
14 changes: 7 additions & 7 deletions lib/Github/Api/GitData/References.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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));
}
}
6 changes: 3 additions & 3 deletions lib/Github/Api/GitData/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}
}
4 changes: 2 additions & 2 deletions lib/Github/Api/GitData/Trees.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}
}
12 changes: 6 additions & 6 deletions lib/Github/Api/Issue.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand All @@ -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));
}

/**
Expand All @@ -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));
}

/**
Expand All @@ -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));
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand Down
Loading