Skip to content

Commit

Permalink
response.buffer() and blob fields doesn't exist in ReactNative
Browse files Browse the repository at this point in the history
Add a check for ReactNative next to the checks for node/browsers so that we don't throw errors using unsupported API's.

Fixes pouchdb#7688.
  • Loading branch information
garfieldnate committed Aug 2, 2019
1 parent a1bd30a commit 55f2227
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/node_modules/pouchdb-adapter-http/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ function HttpPouch(opts, callback) {
var path = encodeDocId(doc._id) + '/' + encodeAttachmentId(filename) +
'?rev=' + doc._rev;
return ourFetch(genDBUrl(host, path)).then(function (response) {
if (typeof process !== 'undefined' && !process.browser) {
if (typeof process !== 'undefined' && !process.browser && !(typeof navigator != 'undefined' && navigator.product == 'ReactNative')) {
return response.buffer();
} else {
/* istanbul ignore next */
Expand All @@ -515,7 +515,7 @@ function HttpPouch(opts, callback) {
}).then(function (blob) {
if (opts.binary) {
// TODO: Can we remove this?
if (typeof process !== 'undefined' && !process.browser) {
if (typeof process !== 'undefined' && !process.browser && !(typeof navigator != 'undefined' && navigator.product == 'ReactNative')) {
blob.type = att.content_type;
}
return blob;
Expand Down

0 comments on commit 55f2227

Please sign in to comment.