Skip to content

Commit 5fc96fb

Browse files
committed
fix(File): use global.Buffer to prevent Buffer from being polyfiled by browserify
1 parent 16027ba commit 5fc96fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/file.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ module.exports = function(AV) {
387387
this._source = AV.Promise.as(data.blob, guessedType);
388388
} else if (typeof File !== "undefined" && data instanceof global.File) {
389389
this._source = AV.Promise.as(data, guessedType);
390-
} else if (typeof Buffer !== "undefined" && global.Buffer.isBuffer(data)) {
390+
} else if (typeof global.Buffer !== "undefined" && global.Buffer.isBuffer(data)) {
391391
// use global.Buffer to prevent browserify pack Buffer module
392392
this.attributes.metaData.size = data.length;
393393
this._source = AV.Promise.as(data, guessedType);
@@ -719,7 +719,7 @@ module.exports = function(AV) {
719719
if (this.attributes.base64) {
720720
data.base64 = this.attributes.base64;
721721
return AV._request('files', this.attributes.name, null, 'POST', data);
722-
} else if (typeof Buffer !== "undefined" && global.Buffer.isBuffer(file)) {
722+
} else if (typeof global.Buffer !== "undefined" && global.Buffer.isBuffer(file)) {
723723
data.base64 = file.toString('base64');
724724
return AV._request('files', this.attributes.name, null, 'POST', data);
725725
} else {

0 commit comments

Comments
 (0)