Skip to content

Commit 28c010c

Browse files
author
Evgeniy Guseletov
committed
Merge pull request #78 from KnpLabs/feature/rawurlencodefix
rawurlencode instead of urlencode, fixes #77
2 parents 3787a1b + 9f53ced commit 28c010c

37 files changed

+198
-172
lines changed

lib/Github/Api/Authorizations.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function all()
1818

1919
public function show($number)
2020
{
21-
return $this->get('authorizations/'.urlencode($number));
21+
return $this->get('authorizations/'.rawurlencode($number));
2222
}
2323

2424
public function create(array $params)
@@ -28,16 +28,16 @@ public function create(array $params)
2828

2929
public function update($id, array $params)
3030
{
31-
return $this->patch('authorizations/'.urlencode($id), $params);
31+
return $this->patch('authorizations/'.rawurlencode($id), $params);
3232
}
3333

3434
public function remove($id)
3535
{
36-
return $this->delete('authorizations/'.urlencode($id));
36+
return $this->delete('authorizations/'.rawurlencode($id));
3737
}
3838

3939
public function check($id, $token)
4040
{
41-
return $this->get('authorizations/'.urlencode($id).'/tokens/'.urlencode($token));
41+
return $this->get('authorizations/'.rawurlencode($id).'/tokens/'.rawurlencode($token));
4242
}
4343
}

lib/Github/Api/CurrentUser/DeployKeys.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function all()
3131
*/
3232
public function show($id)
3333
{
34-
return $this->get('user/keys/'.urlencode($id));
34+
return $this->get('user/keys/'.rawurlencode($id));
3535
}
3636

3737
/**
@@ -68,7 +68,7 @@ public function update($id, array $params)
6868
throw new MissingArgumentException(array('title', 'key'));
6969
}
7070

71-
return $this->patch('user/keys/'.urlencode($id), $params);
71+
return $this->patch('user/keys/'.rawurlencode($id), $params);
7272
}
7373

7474
/**
@@ -80,6 +80,6 @@ public function update($id, array $params)
8080
*/
8181
public function remove($id)
8282
{
83-
return $this->delete('user/keys/'.urlencode($id));
83+
return $this->delete('user/keys/'.rawurlencode($id));
8484
}
8585
}

lib/Github/Api/CurrentUser/Followers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function all($page = 1)
3333
*/
3434
public function check($username)
3535
{
36-
return $this->get('user/following/'.urlencode($username));
36+
return $this->get('user/following/'.rawurlencode($username));
3737
}
3838

3939
/**
@@ -45,7 +45,7 @@ public function check($username)
4545
*/
4646
public function follow($username)
4747
{
48-
return $this->put('user/following/'.urlencode($username));
48+
return $this->put('user/following/'.rawurlencode($username));
4949
}
5050

5151
/**
@@ -57,6 +57,6 @@ public function follow($username)
5757
*/
5858
public function unfollow($username)
5959
{
60-
return $this->delete('user/following/'.urlencode($username));
60+
return $this->delete('user/following/'.rawurlencode($username));
6161
}
6262
}

lib/Github/Api/CurrentUser/Notifications.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function all(array $params = array())
3333
*/
3434
public function allInRepository($username, $repository, array $params = array())
3535
{
36-
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/notifications', $params);
36+
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
3737
}
3838

3939
/**
@@ -57,7 +57,7 @@ public function markAsReadAll(array $params = array())
5757
*/
5858
public function markAsReadInRepository($username, $repository, array $params = array())
5959
{
60-
return $this->put('repos/'.urlencode($username).'/'.urlencode($repository).'/notifications', $params);
60+
return $this->put('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
6161
}
6262

6363
/**
@@ -69,7 +69,7 @@ public function markAsReadInRepository($username, $repository, array $params = a
6969
*/
7070
public function markAsRead($id, array $params)
7171
{
72-
return $this->patch('notifications/threads/'.urlencode($id), $params);
72+
return $this->patch('notifications/threads/'.rawurlencode($id), $params);
7373
}
7474

7575
/**
@@ -80,7 +80,7 @@ public function markAsRead($id, array $params)
8080
*/
8181
public function show($id)
8282
{
83-
return $this->get('notifications/threads/'.urlencode($id));
83+
return $this->get('notifications/threads/'.rawurlencode($id));
8484
}
8585

8686
/**
@@ -91,7 +91,7 @@ public function show($id)
9191
*/
9292
public function showSubscription($id)
9393
{
94-
return $this->get('notifications/threads/'.urlencode($id).'/subscription');
94+
return $this->get('notifications/threads/'.rawurlencode($id).'/subscription');
9595
}
9696

9797
/**
@@ -103,7 +103,7 @@ public function showSubscription($id)
103103
*/
104104
public function createSubscription($id, array $params)
105105
{
106-
return $this->put('notifications/threads/'.urlencode($id).'/subscription', $params);
106+
return $this->put('notifications/threads/'.rawurlencode($id).'/subscription', $params);
107107
}
108108

109109
/**
@@ -114,6 +114,6 @@ public function createSubscription($id, array $params)
114114
*/
115115
public function removeSubscription($id)
116116
{
117-
return $this->delete('notifications/threads/'.urlencode($id).'/subscription');
117+
return $this->delete('notifications/threads/'.rawurlencode($id).'/subscription');
118118
}
119119
}

lib/Github/Api/CurrentUser/Watchers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function all($page = 1)
3434
*/
3535
public function check($username, $repository)
3636
{
37-
return $this->get('user/watched/'.urlencode($username).'/'.urlencode($repository));
37+
return $this->get('user/watched/'.rawurlencode($username).'/'.rawurlencode($repository));
3838
}
3939

4040
/**
@@ -47,7 +47,7 @@ public function check($username, $repository)
4747
*/
4848
public function watch($username, $repository)
4949
{
50-
return $this->put('user/watched/'.urlencode($username).'/'.urlencode($repository));
50+
return $this->put('user/watched/'.rawurlencode($username).'/'.rawurlencode($repository));
5151
}
5252

5353
/**
@@ -60,6 +60,6 @@ public function watch($username, $repository)
6060
*/
6161
public function unwatch($username, $repository)
6262
{
63-
return $this->delete('user/watched/'.urlencode($username).'/'.urlencode($repository));
63+
return $this->delete('user/watched/'.rawurlencode($username).'/'.rawurlencode($repository));
6464
}
6565
}

lib/Github/Api/Gists.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public function all($type = null)
2020
return $this->get('gists');
2121
}
2222

23-
return $this->get('gists/'.urlencode($type));
23+
return $this->get('gists/'.rawurlencode($type));
2424
}
2525

2626
public function show($number)
2727
{
28-
return $this->get('gists/'.urlencode($number));
28+
return $this->get('gists/'.rawurlencode($number));
2929
}
3030

3131
public function create(array $params)
@@ -41,31 +41,31 @@ public function create(array $params)
4141

4242
public function update($id, array $params)
4343
{
44-
return $this->patch('gists/'.urlencode($id), $params);
44+
return $this->patch('gists/'.rawurlencode($id), $params);
4545
}
4646

4747
public function fork($id)
4848
{
49-
return $this->post('gists/'.urlencode($id).'/fork');
49+
return $this->post('gists/'.rawurlencode($id).'/fork');
5050
}
5151

5252
public function remove($id)
5353
{
54-
return $this->delete('gists/'.urlencode($id));
54+
return $this->delete('gists/'.rawurlencode($id));
5555
}
5656

5757
public function check($id)
5858
{
59-
return $this->get('gists/'.urlencode($id).'/star');
59+
return $this->get('gists/'.rawurlencode($id).'/star');
6060
}
6161

6262
public function star($id)
6363
{
64-
return $this->put('gists/'.urlencode($id).'/star');
64+
return $this->put('gists/'.rawurlencode($id).'/star');
6565
}
6666

6767
public function unstar($id)
6868
{
69-
return $this->delete('gists/'.urlencode($id).'/star');
69+
return $this->delete('gists/'.rawurlencode($id).'/star');
7070
}
7171
}

lib/Github/Api/GitData/Blobs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function configure($bodyType = null)
2222

2323
public function show($username, $repository, $sha)
2424
{
25-
$response = $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/blobs/'.urlencode($sha));
25+
$response = $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs/'.rawurlencode($sha));
2626

2727
return $response;
2828
}
@@ -33,6 +33,6 @@ public function create($username, $repository, array $params)
3333
throw new MissingArgumentException(array('content', 'encoding'));
3434
}
3535

36-
return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/git/blobs', $params);
36+
return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs', $params);
3737
}
3838
}

lib/Github/Api/GitData/Commits.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Commits extends AbstractApi
1313
{
1414
public function show($username, $repository, $sha)
1515
{
16-
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/commits/'.urlencode($sha));
16+
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha));
1717
}
1818

1919
public function create($username, $repository, array $params)
@@ -22,6 +22,6 @@ public function create($username, $repository, array $params)
2222
throw new MissingArgumentException(array('message', 'tree', 'parents'));
2323
}
2424

25-
return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/git/commits', $params);
25+
return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/commits', $params);
2626
}
2727
}

lib/Github/Api/GitData/References.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ class References extends AbstractApi
1313
{
1414
public function all($username, $repository)
1515
{
16-
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs');
16+
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs');
1717
}
1818

1919
public function branches($username, $repository)
2020
{
21-
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs/heads');
21+
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/heads');
2222
}
2323

2424
public function tags($username, $repository)
2525
{
26-
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs/tags');
26+
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/tags');
2727
}
2828

2929
public function show($username, $repository, $reference)
3030
{
31-
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs/'.urlencode($reference));
31+
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.rawurlencode($reference));
3232
}
3333

3434
public function create($username, $repository, array $params)
@@ -37,7 +37,7 @@ public function create($username, $repository, array $params)
3737
throw new MissingArgumentException(array('ref', 'sha'));
3838
}
3939

40-
return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs', $params);
40+
return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs', $params);
4141
}
4242

4343
public function update($username, $repository, $reference, array $params)
@@ -46,11 +46,11 @@ public function update($username, $repository, $reference, array $params)
4646
throw new MissingArgumentException('sha');
4747
}
4848

49-
return $this->patch('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs/'.urlencode($reference), $params);
49+
return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.rawurlencode($reference), $params);
5050
}
5151

5252
public function remove($username, $repository, $reference)
5353
{
54-
return $this->delete('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs/'.urlencode($reference));
54+
return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.rawurlencode($reference));
5555
}
5656
}

lib/Github/Api/GitData/Tags.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ class Tags extends AbstractApi
1313
{
1414
public function all($username, $repository)
1515
{
16-
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/refs/tags');
16+
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/tags');
1717
}
1818

1919
public function show($username, $repository, $sha)
2020
{
21-
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/git/tags/'.urlencode($sha));
21+
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/tags/'.rawurlencode($sha));
2222
}
2323

2424
public function create($username, $repository, array $params)
@@ -35,6 +35,6 @@ public function create($username, $repository, array $params)
3535
throw new MissingArgumentException(array('tagger.name', 'tagger.email', 'tagger.date'));
3636
}
3737

38-
return $this->post('repos/'.urlencode($username).'/'.urlencode($repository).'/git/tags', $params);
38+
return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/tags', $params);
3939
}
4040
}

0 commit comments

Comments
 (0)