-
Notifications
You must be signed in to change notification settings - Fork 194
Description
When my web-application was in online mode, everything ran perfect. Everytime the CacheWebView ran in offline mode (all files were retrieved from cache only), my web-application encountered crazy behaviours like the assets of similiar visualisations were confused/mixed up,
While analyzing the runtime behaviour of the cache, I discovered the following issue:
The method "- (NSString *)cachePathForRequest:(NSURLRequest *)aRequest" sometimes produces non unique filenames. I found out about that by "NSLog(@"%@, %@\n", [[aRequest URL] absoluteString], fileName)" where fileName represents the generated path filename using [NString hash].
I managed to isolate the problem and located the problem as the use of [NSString hash].
[@"http://192.168.1.157/schmitz-web/assets/img/colorizer/models/medimatic_gyn/polster_pergament.png?cacheToken=1" hash]
[@"http://192.168.1.157/schmitz-web/assets/img/colorizer/models/medimatic_uro/polster_pergament.png?cacheToken=1 " hash]
Will result into the same hash value.
Further details on that can be found here: http://www.abakia.de/blog/blog/2012/12/05/nsstring-hash-is-bad/
I will supply a pull request for that.