mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-18 20:21:36 +00:00
commit
173161cc47
@ -52,11 +52,7 @@ exports.toUInt32 = toUInt32
|
||||
* @return {Object}
|
||||
*/
|
||||
exports.querystringParse = function (q) {
|
||||
var saved = querystring.unescape
|
||||
querystring.unescape = unescape // global
|
||||
var ret = querystring.parse(q)
|
||||
querystring.unescape = saved
|
||||
return ret
|
||||
return querystring.parse(q, null, null, { decodeURIComponent: unescape })
|
||||
}
|
||||
|
||||
/**
|
||||
@ -66,13 +62,10 @@ exports.querystringParse = function (q) {
|
||||
* @return {string}
|
||||
*/
|
||||
exports.querystringStringify = function (obj) {
|
||||
var saved = querystring.escape
|
||||
querystring.escape = escape // global
|
||||
var ret = querystring.stringify(obj)
|
||||
var ret = querystring.stringify(obj, null, null, { encodeURIComponent: escape })
|
||||
ret = ret.replace(/[@*/+]/g, function (char) {
|
||||
// `escape` doesn't encode the characters @*/+ so we do it manually
|
||||
return '%' + char.charCodeAt(0).toString(16).toUpperCase()
|
||||
})
|
||||
querystring.escape = saved
|
||||
return ret
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user