Skip to content

Commit

Permalink
Merge pull request SDWebImage#976 from ghazel/file-extension
Browse files Browse the repository at this point in the history
append the original path extension to the hash filename. closes SDWebImage#967
  • Loading branch information
bpoplauschi committed Sep 30, 2015
2 parents 7a48ca6 + 9af7460 commit 577fefa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions SDWebImage/SDImageCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ - (NSString *)cachedFileNameForKey:(NSString *)key {
}
unsigned char r[CC_MD5_DIGEST_LENGTH];
CC_MD5(str, (CC_LONG)strlen(str), r);
NSString *filename = [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], r[11], r[12], r[13], r[14], r[15]];
NSString *filename = [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x.%@",
r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], r[11], r[12], r[13], r[14], r[15],
[key pathExtension]];

return filename;
}
Expand Down

0 comments on commit 577fefa

Please sign in to comment.