Skip to content

Commit

Permalink
Merge pull request #36 from ccerinojr/bugfix/28
Browse files Browse the repository at this point in the history
Bugfix/28
  • Loading branch information
garrettmoon committed Oct 29, 2015
2 parents 3a0d1c5 + 4f304e0 commit f8e95b5
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions PINCache/PINDiskCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,26 +143,14 @@ - (NSString *)encodedString:(NSString *)string
{
if (![string length])
return @"";

CFStringRef static const charsToEscape = CFSTR(".:/");
CFStringRef escapedString = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
(__bridge CFStringRef)string,
NULL,
charsToEscape,
kCFStringEncodingUTF8);
return (__bridge_transfer NSString *)escapedString;
return [string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@".:/"]];
}

- (NSString *)decodedString:(NSString *)string
{
if (![string length])
return @"";

CFStringRef unescapedString = CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault,
(__bridge CFStringRef)string,
CFSTR(""),
kCFStringEncodingUTF8);
return (__bridge_transfer NSString *)unescapedString;
return [string stringByRemovingPercentEncoding];
}

#pragma mark - Private Trash Methods -
Expand Down

0 comments on commit f8e95b5

Please sign in to comment.