ionic-team / ionic-team/cordova-plugin-ionic-webview

[Android] convertFileSrc does not correctly convert sdcard paths.

Open
#598 10 comments 2 reactions 0 assignees View on GitHub
Dominant language
Objective-C
Stars
493
Forks
410
PR merge metrics
No merged PRs in 30d

Description

After choose a file this nativePath is returned:

```file:///sdcard/Music/Sinéad O'Connor/Sean Nos Jua (2002)/05 - Óró Sé Do Bheatha 'Bhaile.flac```

parsing it with `convertFileSrc` returns:
```https://localhost/_app_file_/sdcard/Music/Sinéad O'Connor/Sean Nos Jua (2002)/05 - Óró Sé Do Bheatha 'Bhaile.flac""```

which can not be loaded by the webview.
Complete file info:
```
{
"extension":".flac","name":"05 - Óró Sé Do Bheatha 'Bhaile",
"nativePath":"file:///sdcard/Music/Sinéad O'Connor/Sean Nos Jua (2002)/05 - Óró Sé Do Bheatha 'Bhaile.flac",
"uri":"content://com.android.externalstorage.documents/document/326E-6BB3%3AMusic%2FSin%C3%A9ad%20O'Connor%2FSean%20Nos%20Jua%20(2002)%2F05%20-%20%C3%93r%C3%B3%20S%C3%A9%20Do%20Bheatha%20'Bhaile.flac",
"ionicPath":"https://localhost/_app_file_/sdcard/Music/Sinéad O'Connor/Sean Nos Jua (2002)/05 - Óró Sé Do Bheatha 'Bhaile.flac"
}
```
Selecting the same file but from the "Music" quick access works as expected.

Also converting the uri instead of the nativePath works as expected but it fails after the app restarts.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.