Cocoalicious 1.0b43
Sunday, June 11th, 2006I’ve kind of been asleep at the Cocoalicious wheel for awhile now, which is a shame because not only have there been some well known problems, I also left the CVS repository in a bad enough state to prevent anyone besides me from fixing said problems. What can I say: it’s summertime, and the living is easy.
Fortunately, I have finally managed to scrape together enough time to get the two biggest problems (a crasher, and a bug that would allow the post cache on disk to be overwritten by blank data in some conditions) fixed. Check out Cocoalicious 1.0b43 for the fixes.
In case anyone’s wondering, the crashing problem that I got so many complaints about had to do with URLs containing literal percent signs, such as the following:
http://www.urbandictionary.com/define.php?term=%s
Basically, the issue was that if you pass NSURL’s URLWithString: method a URL like that, it will simply return nil instead of a new NSURL, because it tries to interpret the “%s” as an escape code, and it’s not a valid escape code. I wasn’t checking for nil before I tried to insert the new URL into an NSArray, which is what would actually cause the crash. The solution would seem simple: just escape the percent sign before you turn the string into a URL object, so you end up with:
http://www.urbandictionary.com/define.php?term=%25s
And this does indeed work, until you submit the URL to del.icio.us and then re-download it. When you get this URL back in the del.icio.us post XML, what you end up with is:
http://www.urbandictionary.com/define.php?term=%2525s
In other words, del.icio.us escaped the percent sign again (”%25″ is the escape code for the percent sign), which means if you edit that post in Cocoalicious and re-submit it, you’ll end up with an incorrect URL.
I’m not sure whether I can consider this a bug or not (it seems to me that del.icio.us shouldn’t naively re-escape the percent signs at the beginning of valid escape sequences), but until I figure out what to do about it, this is going to be a known issue in Cocoalicious.