Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ios
/
yh_sdwebimage
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
Stanislas Chevallier
7 years ago
Commit
69fe97926603f3aff568aa9157916c434722810e
1 parent
c1df7828
Fixed cached image filename generated with invalid path extensions
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
SDWebImage/SDImageCache.m
SDWebImage/SDImageCache.m
View file @
69fe979
...
...
@@ -171,10 +171,11 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
}
unsigned
char
r
[
CC_MD5_DIGEST_LENGTH
];
CC_MD5
(
str
,
(
CC_LONG
)
strlen
(
str
),
r
);
NSURL
*
keyURL
=
[
NSURL
URLWithString
:
key
];
NSString
*
ext
=
keyURL
?
keyURL
.
pathExtension
:
key
.
pathExtension
;
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
isEqualToString
:
@""
]
?
@""
:
[
NSString
stringWithFormat
:
@".%@"
,
key
.
pathExtension
]];
r
[
11
],
r
[
12
],
r
[
13
],
r
[
14
],
r
[
15
],
ext
.
length
==
0
?
@""
:
[
NSString
stringWithFormat
:
@".%@"
,
ext
]];
return
filename
;
}
...
...
Please
register
or
login
to post a comment