Closed abernardobr closed 9 years ago
Using:
Parsing a URL w/o any query string on CentOS, returns url.query: null and not url.query: {}.
By calling url.query crashes since it was expecting at least an empty object and now it is null.
exports.canonicalizeResource = function(resource){ var url = parse(resource, true) , path = url.pathname , buf = []; // apply the query string whitelist Object.keys(url.query).forEach(function (key) { if (whitelist.indexOf(key) != -1) { buf.push(key + (url.query[key] ? "=" + url.query[key] : '')); } }); return path + (buf.length ? '?' + buf.sort().join('&') : ''); };
possible fix:
exports.canonicalizeResource = function(resource){ var url = parse(resource, true) , path = url.pathname , buf = []; url.query = url.query == null ? {} : url.query; // apply the query string whitelist Object.keys(url.query).forEach(function (key) { if (whitelist.indexOf(key) != -1) { buf.push(key + (url.query[key] ? "=" + url.query[key] : '')); } }); return path + (buf.length ? '?' + buf.sort().join('&') : ''); };
Dupe of #250, #251, #252, #253, #256.
Using:
Parsing a URL w/o any query string on CentOS, returns url.query: null and not url.query: {}.
By calling url.query crashes since it was expecting at least an empty object and now it is null.
possible fix: