Embedded % symbol crashes #92

Closed
axtens opened this Issue May 27, 2013 · 1 comment

Projects

None yet

2 participants

@axtens
axtens commented May 27, 2013

Context: Microsoft JScript on Windows Server 2008 R2 64bit

var url = "http://www.google.com/url?sa=t&rct=j&q=% FREE Call Forwarding&source=web&cd=27&cad=rja&ved=0CG8QFjAGOBQ";
var x = new URI(url);
var rMap = x.search(true);

When the .search is executed I get
Microsoft JScript runtime error: The URI to be decoded is not a valid encoding

The break occurs here
d.decodeQuery = function (a) {
return d.decode((a + "").replace(/+/g, "%20"))
};

It's probably complaining about the "q=% FREE Call Forwarding". The percent symbol in this case is not introducing an encoded value. In my own code I'll check for a % after unescaping and change it to something (not sure what yet). However, what can be done for URI.js?

@rodneyrehm
Member

I've fixed this in master - it will be included in the next release. thank you for your help!

QueryString data that cannot be decoded will now simply be returned undecoded - that way any decodable data can still be of use.

@rodneyrehm rodneyrehm closed this Aug 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment