Merge pull request #4262 from dpalou/MOBILE-4688
MOBILE-4688 file: Fix files with unencoded % in iOS toomain
commit
ef90e210fc
|
@ -152,7 +152,7 @@ export class CoreFileProvider {
|
||||||
try {
|
try {
|
||||||
return <FileEntry> await File.resolveLocalFilesystemUrl(this.addBasePathIfNeeded(path));
|
return <FileEntry> await File.resolveLocalFilesystemUrl(this.addBasePathIfNeeded(path));
|
||||||
} catch (error) {
|
} 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.
|
// Cannot read some files if the path contains the % character and it's not an encoded char. Try encoding it.
|
||||||
const encodedPath = encodeURI(path);
|
const encodedPath = encodeURI(path);
|
||||||
if (encodedPath !== path) {
|
if (encodedPath !== path) {
|
||||||
|
@ -178,7 +178,7 @@ export class CoreFileProvider {
|
||||||
try {
|
try {
|
||||||
return await File.resolveDirectoryUrl(this.addBasePathIfNeeded(path));
|
return await File.resolveDirectoryUrl(this.addBasePathIfNeeded(path));
|
||||||
} catch (error) {
|
} 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.
|
// Cannot read some files if the path contains the % character and it's not an encoded char. Try encoding it.
|
||||||
const encodedPath = encodeURI(path);
|
const encodedPath = encodeURI(path);
|
||||||
if (encodedPath !== path) {
|
if (encodedPath !== path) {
|
||||||
|
|
Loading…
Reference in New Issue