From 199a282ba6b7e9e871a6d88caaa390dbc1e25e77 Mon Sep 17 00:00:00 2001 From: "dr.dimitru" Date: Thu, 16 Feb 2017 01:21:22 +0300 Subject: [PATCH 1/2] Buffer.from pollyfill - See #355 - `Buffer.from` has no support of `base64` in some versions of node.js, while `Buffer.from` suggested replacement for deprecated `new Buffer()` constructor --- files.coffee | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/files.coffee b/files.coffee index 91b828ab..ee1fbdc0 100755 --- a/files.coffee +++ b/files.coffee @@ -661,7 +661,7 @@ class FilesCollection self._currentUploads[doc._id].end() unless doc.isFinished - console.info "[FilesCollection] [_preCollectionCursor.observe] [removeUnfinishedUpload]: #{doc.file.path}" if self.debug + console.info "[FilesCollection] [_preCollectionCursor.observe] [removeUnfinishedUpload]: #{doc._id}" if self.debug self._currentUploads[doc._id].abort() delete self._currentUploads[doc._id] @@ -799,8 +799,11 @@ class FilesCollection if request.headers['x-eof'] is '1' opts.eof = true else - if typeof Buffer.from == 'function' - opts.binData = Buffer.from body, 'base64' + if typeof Buffer.from is 'function' + try + opts.binData = Buffer.from body, 'base64' + catch e + opts.binData = new Buffer body, 'base64' else opts.binData = new Buffer body, 'base64' opts.chunkId = parseInt request.headers['x-chunkid'] @@ -977,8 +980,11 @@ class FilesCollection } if opts.binData - if typeof Buffer.from == 'function' - opts.binData = Buffer.from opts.binData, 'base64' + if typeof Buffer.from is 'function' + try + opts.binData = Buffer.from opts.binData, 'base64' + catch e + opts.binData = new Buffer opts.binData, 'base64' else opts.binData = new Buffer opts.binData, 'base64' From b92977c9a2cc754b553fe2e02bb6117d3a79b3fb Mon Sep 17 00:00:00 2001 From: "dr.dimitru" Date: Thu, 16 Feb 2017 01:29:16 +0300 Subject: [PATCH 2/2] v1.7.11 - Fix #355 - `Buffer.from` has no support of `base64` in some versions of node.js, while `Buffer.from` suggested replacement for deprecated `new Buffer()` constructor - Other minor fixes --- .versions | 2 +- package.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.versions b/.versions index ff0893a6..2a2342b3 100644 --- a/.versions +++ b/.versions @@ -36,7 +36,7 @@ npm-mongo@1.5.45 observe-sequence@1.0.12 ordered-dict@1.0.8 ostrio:cookies@2.1.3 -ostrio:files@1.7.10 +ostrio:files@1.7.11 promise@0.8.3 random@1.0.10 reactive-var@1.0.10 diff --git a/package.js b/package.js index 695c20ba..a4daf213 100755 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'ostrio:files', - version: '1.7.10', + version: '1.7.11', summary: 'Upload files via DDP, HTTP and WebRTC/DC. To server FS, AWS, GridFS, DropBox or Google Drive.', git: 'https://github.com/VeliovGroup/Meteor-Files', documentation: 'README.md'