evermeer / EVURLCache

a NSURLCache subclass for handling all web requests that use NSURLRequest
Other
297 stars 49 forks source link

Caching raw data cause crash #27

Closed npjk closed 8 years ago

npjk commented 8 years ago

Hi there,

I discovered a crash today when trying to cache a page that contain an iframe (Youtube video). I get that message in the log : WARNING: Unable to get the path from the request: <NSURLRequest: 0x154dd4750> { URL: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsB ... rkJggg== }

I figured out that the code was not able to define a path in storagePathForRequest:rootPath as request.URL, in this case, is nil.

So I made a workaround to prevent my app from crashing by making sure localUrl is not nil here : https://github.com/nartex/EVURLCache/tree/nicolas255-patch-1 I think that it should be handled better if possible but I have no idea how to to do that.

evermeer commented 8 years ago

Thanks!

I have changed your fix a little and pushed it as version 2.9.0 to GitHub and CocoaPods