apache / apache/cordova-plugin-inappbrowser
exposed beyond app through Intent.getData()
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
### Issue Type
- [x] Bug Report
- [ ] Feature Request
- [x] Support Question
## Description
Hi, try to open an pdf file on Android 9 we receive following error:
03-18 09:38:08.088: D/InAppBrowser(24114): InAppBrowser: Error loading url file:///storage/emulated/0/Documents/CRM-MOBILE/tmp/quote.pdf:android.os.FileUriExposedException: file:///storage/emulated/0/Documents/CRM-MOBILE/tmp/quote.pdf exposed beyond app through Intent.getData()
## Information
The workaround to set target android sdk to old 23 is not possible for security contraints on Google Play Console
### Command or Code
export const openPdfFile = (url, target = '_blank') => {
// for android target is always _system because InAppBrowser does not open it;
// with _system, the default pdf app of the device is opened.
// url = file:///storage/emulated/0/Documents/CRM-MOBILE/tmp/quote.pdf
return isIOS() ? window.open(url, target) : window.open(url, '_system'):
};
### Environment, Platform, Device
all Android devices
### Version information
Android 9
cordova platform
Installed platforms:
android 7.1.2
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
## Checklist
- [x] I searched for already existing GitHub issues about this
- [x] I updated all Cordova tooling to their most recent version
- [ ] I included all the necessary information above
Contributor guide
Research direction
Start with the Android implementation of InAppBrowser and reproduce opening the file:///storage/emulated/0/Documents/CRM-MOBILE/tmp/quote.pdf URL through window.open(url, '_system') on Android 9. Investigate the reported FileUriExposedException; done means the PDF opens on current Android targets without requiring target SDK 23.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java, javascript
- Domain
- mobile-dev, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100