NSFileManager/NSURL incorrectly decode '%' characters in path components

Originator:twiomood
Number:rdar://14005606 Date Originated:28-May-2013
Status:Open Resolved:
Product:Mac OS X Product Version:10.8.3
Classification:Crash/Data Loss Reproducible:Always
 
Summary:
NSFileManager/NSURL can incorrectly decode '%' characters in path components. It is totally valid to have a file name of "%FF.ext" (which would be "%25FF.ext" once embedded in a URL). But in some cases, NSFileManager or NSURL can incorrectly decode that sequence.

Steps to Reproduce:
Run the attached sample.
When given a parent directory of '%25FF', NSFileManager returns children URLs containing '%FF/filename.ext'. That is, it has incorrectly put a URL-decoded path component into the URL.


Expected Results:
The %FF should stay encoded as '%25FF' in the child URLs

Actual Results:
Crash/bizarre behavior when things like -lastPathComponent start returning nil unexpectedly.


Version:
10.8.3

Notes:


Sample at https://gist.github.com/tjw/5666537

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!