MOBILE-4688 file: Fix files with unencoded % in iOS too

main
Dani Palou 2024-12-12 09:55:52 +01:00
parent c08fff39c0
commit 6764ab74b5
1 changed files with 2 additions and 2 deletions

View File

@ -152,7 +152,7 @@ export class CoreFileProvider {
try {
return <FileEntry> 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) {