NSURL -isEqual: should decode paths before comparing

Originator:twiomood
Number:rdar://13443089 Date Originated:2013-03-18
Status:Open Resolved:
Product: Product Version:
Classification:Other Bug Reproducible:Always
 
18-Mar-2013 11:09 AM Timothy Wood:
Summary:
NSURL -isEqual: should decode paths before comparing

Steps to Reproduce:
Compile and run the attached command line tool.

Expected Results:
NSURL should compare the decoded paths, not the encoded paths so that the %5b vs %5B case difference doesn't spuriously make these URLs seem different

Actual Results:
-isEqual: returns NO

Regression:
N/A

Notes:
Probably a bug on iOS as well.


18-Mar-2013 11:19 AM Timothy Wood:
http://tools.ietf.org/html/rfc3986#section-2.1 says

"The uppercase hexadecimal digits 'A' through 'F' are equivalent to
   the lowercase digits 'a' through 'f', respectively.  If two URIs
   differ only in the case of hexadecimal digits used in percent-encoded
   octets, they are equivalent.  For consistency, URI producers and
   normalizers should use uppercase hexadecimal digits for all percent-
   encodings."
   
NSURL's documentation says that it intentionaly violates RFC 3986:

"Two NSURLs are considered equal if and only if they return identical values for both baseURL and relativeString."

(see https://gist.github.com/tjw/5189498 for source)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!