From 6764ab74b5851b09a5ebe81c296f08df46cbf6cc Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 12 Dec 2024 09:55:52 +0100 Subject: [PATCH] MOBILE-4688 file: Fix files with unencoded % in iOS too --- src/core/services/file.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/services/file.ts b/src/core/services/file.ts index 90ec50d44..6e23a98c7 100644 --- a/src/core/services/file.ts +++ b/src/core/services/file.ts @@ -152,7 +152,7 @@ export class CoreFileProvider { try { return await File.resolveLocalFilesystemUrl(this.addBasePathIfNeeded(path)); } catch (error) { - if (error && error.code === FileError.NOT_FOUND_ERR) { + if (error && (error.code === FileError.NOT_FOUND_ERR || error.code === FileError.ENCODING_ERR)) { // Cannot read some files if the path contains the % character and it's not an encoded char. Try encoding it. const encodedPath = encodeURI(path); if (encodedPath !== path) { @@ -178,7 +178,7 @@ export class CoreFileProvider { try { return await File.resolveDirectoryUrl(this.addBasePathIfNeeded(path)); } catch (error) { - if (error && error.code === FileError.NOT_FOUND_ERR) { + if (error && (error.code === FileError.NOT_FOUND_ERR || error.code === FileError.ENCODING_ERR)) { // Cannot read some files if the path contains the % character and it's not an encoded char. Try encoding it. const encodedPath = encodeURI(path); if (encodedPath !== path) {