Using encodeURIComponent escapes the URL properly to be passed as a Query String value.

Thanks, octatone!
This commit is contained in:
Kerrick Long
2011-06-28 17:12:25 -05:00
parent 53f5a57081
commit d2fa85f5ae
+1 -1
View File
@@ -240,7 +240,7 @@ RedditAPI.prototype.getInfo = function (url) {
matches = url.match(this.commentsMatchPattern);
reqUrl = 'http://' + this.domain + '/by_id/t3_' + matches[3] + '.json';
} else {
reqUrl = 'http://' + this.domain + '/api/info.json?url=' + encodeURI(url);
reqUrl = 'http://' + this.domain + '/api/info.json?url=' + encodeURIComponent(url);
}
response = this.apiTransmit('GET', reqUrl, false);