Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ export default class Pdf extends Component {
const isNetwork = !!(uri && uri.match(/^https?:\/\//));
const isAsset = !!(uri && uri.match(/^bundle-assets:\/\//));
const isBase64 = !!(uri && uri.match(/^data:application\/pdf;base64/));
const isContentUri = !!(uri && uri.match(/^content:\/\//i));

const filename = source.cacheFileName || SHA1(uri) + '.pdf';
const cacheFile = ReactNativeBlobUtil.fs.dirs.CacheDir + '/' + filename;
Expand Down Expand Up @@ -291,7 +292,11 @@ export default class Pdf extends Component {
});
} else {
if (this._mounted) {
const localPath = decodeURIComponent(uri.replace(/file:\/\//i, ''));
// Android grants scoped access to the exact content URI. Decoding
// it changes the permission key (for example, %3A becomes :).
const localPath = isContentUri
? uri
: decodeURIComponent(uri.replace(/file:\/\//i, ''));
if (this.props.transformFile) {
try {
const viewFile = await this._transformToViewFile(localPath);
Expand Down