Skip to content

Commit

Permalink
Merge pull request #18 from wcandillon/wcandillon-patch-5
Browse files Browse the repository at this point in the history
Fix non-JPG image support
  • Loading branch information
wcandillon authored Mar 9, 2017
2 parents 4440aaa + 3a65f24 commit 5f24910
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-img-cache",
"version": "1.1.6",
"version": "1.1.7",
"description": "CachedImage component for React native",
"main": "build/index.js",
"typings": "build/index.d.ts",
Expand Down
5 changes: 3 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ type CacheEntry = {
export class ImageCache {

private getPath(uri: string, immutable?: boolean): string {
const ext = uri.substring(uri.lastIndexOf("."));
if (immutable === true) {
return dirs.CacheDir + "/" + SHA1(uri) + ".jpg";
return dirs.CacheDir + "/" + SHA1(uri) + ext;
} else {
return dirs.CacheDir + "/" + s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4() + ".jpg";
return dirs.CacheDir + "/" + s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4() + ext;
}
}

Expand Down

0 comments on commit 5f24910

Please sign in to comment.