From 3b23c471a12886bb85d0654c70c16aa1f99cbd47 Mon Sep 17 00:00:00 2001 From: Jonathan Goode Date: Sun, 4 Aug 2024 09:20:06 +0100 Subject: [PATCH] feat(ios): replace deprecated properties (#631) --- src/ios/CDVFile.m | 4 ++-- src/ios/CDVLocalFilesystem.m | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ios/CDVFile.m b/src/ios/CDVFile.m index 59e7d6407..570bc4577 100644 --- a/src/ios/CDVFile.m +++ b/src/ios/CDVFile.m @@ -586,8 +586,8 @@ - (void)resolveLocalFileSystemURI:(CDVInvokedUrlCommand*)command //encode path with percent escapes -(NSString *)encodePath:(NSString *)path { - NSString *decodedPath = [path stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; //decode incase it's already encoded to avoid encoding twice - return [decodedPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + NSString *decodedPath = [path stringByRemovingPercentEncoding:NSUTF8StringEncoding]; //decode incase it's already encoded to avoid encoding twice + return [decodedPath stringByAddingPercentEncodingWithAllowedCharacters:NSUTF8StringEncoding]; } diff --git a/src/ios/CDVLocalFilesystem.m b/src/ios/CDVLocalFilesystem.m index c340ce0cc..983325eea 100644 --- a/src/ios/CDVLocalFilesystem.m +++ b/src/ios/CDVLocalFilesystem.m @@ -125,7 +125,7 @@ - (NSString *)filesystemPathForURL:(CDVFilesystemURL *)url - (CDVFilesystemURL *)URLforFullPath:(NSString *)fullPath { if (fullPath) { - NSString* escapedPath = [fullPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + NSString* escapedPath = [fullPath stringByAddingPercentEncodingWithAllowedCharacters:NSUTF8StringEncoding]; if ([fullPath hasPrefix:@"/"]) { return [CDVFilesystemURL fileSystemURLWithString:[NSString stringWithFormat:@"%@://localhost/%@%@", kCDVFilesystemURLPrefix, self.name, escapedPath]]; }