mirror of
https://gitee.com/shuto/cordova-plugin-file-opener2.git
synced 2025-01-31 03:52:51 +08:00
Fixed iOS encoding if path parameter is already encoded
This commit is contained in:
parent
3517585d45
commit
01ac6a5d7d
@ -53,7 +53,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSURL *fileURL = [NSURL fileURLWithPath:[path stringByReplacingOccurrencesOfString:@"file://" withString:@""]];;
|
||||
NSURL *fileURL = NULL;
|
||||
NSString *decodedPath = [path stringByRemovingPercentEncoding];
|
||||
if ([path isEqualToString:decodedPath]) {
|
||||
NSLog(@"Path parameter not encoded. Building file URL encoding it...");
|
||||
fileURL = [NSURL fileURLWithPath:[path stringByReplacingOccurrencesOfString:@"file://" withString:@""]];;
|
||||
} else {
|
||||
NSLog(@"Path parameter already encoded. Building file URL without encoding it...");
|
||||
fileURL = [NSURL URLWithString:path];
|
||||
}
|
||||
|
||||
localFile = fileURL.path;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user