Merge pull request #4262 from dpalou/MOBILE-4688

MOBILE-4688 file: Fix files with unencoded % in iOS too
main
Pau Ferrer Ocaña 2024-12-12 10:17:57 +01:00 committed by GitHub
commit ef90e210fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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) {