Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit efbbd37

Browse files
committed
Always urlencode
1 parent c91356f commit efbbd37

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/Request.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,7 @@ function apiURL() {
105105
if ($this->quality) $options[] = 'quality=' . $this->quality;
106106
if ($this->timeout) $options[] = 'timeout=' . $this->timeout;
107107

108-
$imageURL = $this->url;
109-
if (preg_match('/[\s%+]/', $imageURL)) {
110-
$imageURL = rawurlencode($imageURL);
111-
}
112-
113-
return self::BASE_URL . '/' . rawurlencode($this->username) . '/' . implode(',', $options) . '/' . $imageURL;
108+
return self::BASE_URL . '/' . rawurlencode($this->username) . '/' . implode(',', $options) . '/' . rawurlencode($this->url);
114109
}
115110

116111
function getBytes() {

test/BasicTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ public function testChains() {
8787
$this->assertContains('2x', $c2->apiURL());
8888
$this->assertContains('1280x300', $c1->apiURL());
8989
$this->assertContains('timeout=34', $c1->apiURL());
90-
$this->assertContains('/http://example.com', $c1->apiURL());
90+
$this->assertContains('/http%3A%2F%2Fexample.com', $c1->apiURL());
9191
}
9292
}

0 commit comments

Comments
 (0)