From 487cbbcd09662cb056fc06e3cf8f189fda045982 Mon Sep 17 00:00:00 2001 From: dr-dimitru Date: Fri, 20 Jan 2017 18:47:07 +0300 Subject: [PATCH 1/5] Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 818181a8..c9f7ae85 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Demo application: Related Packages: ======== - - [pyfiles (meteor-python-files))](https://github.com/VeliovGroup/meteor-python-files) Python Client for Meteor-Files package + - [pyfiles (meteor-python-files)](https://github.com/VeliovGroup/meteor-python-files) Python Client for Meteor-Files package - [meteor-autoform-file](https://github.com/VeliovGroup/meteor-autoform-file) - Upload and manage files with [autoForm](https://github.com/aldeed/meteor-autoform) From 138a0133ebcb7f828c92dec09829ce080ca45fee Mon Sep 17 00:00:00 2001 From: Marco Wettstein Date: Sat, 21 Jan 2017 17:36:28 +0100 Subject: [PATCH 2/5] Update files.coffee --- files.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files.coffee b/files.coffee index 1f66464c..c1dfb855 100755 --- a/files.coffee +++ b/files.coffee @@ -556,7 +556,7 @@ class FilesCollection setTokenCookie = -> Meteor.setTimeout -> if (not cookie.has('x_mtok') and Meteor.connection._lastSessionId) or (cookie.has('x_mtok') and (cookie.get('x_mtok') isnt Meteor.connection._lastSessionId)) - cookie.set 'x_mtok', Meteor.connection._lastSessionId + cookie.set 'x_mtok', Meteor.connection._lastSessionId, path: '/' return , 25 return From 43b4c38ca198ebafac9b17dbfdc24fd7452ffd36 Mon Sep 17 00:00:00 2001 From: dr-dimitru Date: Tue, 24 Jan 2017 05:31:08 +0300 Subject: [PATCH 3/5] Fix #327 --- files.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files.coffee b/files.coffee index c1dfb855..37a6b7d3 100755 --- a/files.coffee +++ b/files.coffee @@ -562,7 +562,7 @@ class FilesCollection return unsetTokenCookie = -> - cookie.remove 'x_mtok' if cookie.has 'x_mtok' + cookie.remove('x_mtok', '/') if cookie.has 'x_mtok' return if Accounts? From d853e7631fbd6fd285d775d9740d95bab0cb3760 Mon Sep 17 00:00:00 2001 From: dr-dimitru Date: Tue, 24 Jan 2017 05:51:59 +0300 Subject: [PATCH 4/5] Fix #324 - See discussion at #331 , thanks to @derwok --- files.coffee | 65 ++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/files.coffee b/files.coffee index 37a6b7d3..97eff3ad 100755 --- a/files.coffee +++ b/files.coffee @@ -641,21 +641,31 @@ class FilesCollection @_preCollection = new Mongo.Collection '__pre_' + @collectionName @_preCollection._ensureIndex {createdAt: 1}, {expireAfterSeconds: @continueUploadTTL, background: true} - _preCollectionCursor = @_preCollection.find {} - _preCollectionCursor.observe removed: (doc) -> - # Free memory after upload is done - # Or if upload is unfinished - console.info "[FilesCollection] [_preCollectionCursor.observe] [removed]: #{doc._id}" if self.debug - if self._currentUploads?[doc._id] - self._currentUploads[doc._id].stop() - self._currentUploads[doc._id].end() - - unless doc.isFinished - console.info "[FilesCollection] [_preCollectionCursor.observe] [removeUnfinishedUpload]: #{doc.file.path}" if self.debug - self._currentUploads[doc._id].abort() - - delete self._currentUploads[doc._id] - return + _preCollectionCursor = @_preCollection.find {}, { + fields: + _id: 1 + isFinished: 1 + } + _preCollectionCursor.observe + changed: (doc) -> + if doc.isFinished + console.info "[FilesCollection] [_preCollectionCursor.observe] [changed]: #{doc._id}" if self.debug + self._preCollection.remove {_id: doc._id}, NOOP + return + removed: (doc) -> + # Free memory after upload is done + # Or if upload is unfinished + console.info "[FilesCollection] [_preCollectionCursor.observe] [removed]: #{doc._id}" if self.debug + if self._currentUploads?[doc._id] + self._currentUploads[doc._id].stop() + self._currentUploads[doc._id].end() + + unless doc.isFinished + console.info "[FilesCollection] [_preCollectionCursor.observe] [removeUnfinishedUpload]: #{doc.file.path}" if self.debug + self._currentUploads[doc._id].abort() + + delete self._currentUploads[doc._id] + return @_createStream = (_id, path, opts) -> return self._currentUploads[_id] = new writeStream path, opts.fileLength, opts, self.permissions @@ -1076,24 +1086,13 @@ class FilesCollection console.error '[FilesCollection] [Upload] [_finishUpload] Error:', error if self.debug else self._preCollection.update {_id: opts.fileId}, {$set: {isFinished: true}} - # we delay the remove to resolve timing issues (details see #324) - Meteor.setTimeout -> - self._preCollection.remove {_id: opts.fileId}, (error) -> - if error - cb and cb error - console.error '[FilesCollection] [Upload] [_finishUpload] Error:', error if self.debug - else - result._id = _id - console.info "[FilesCollection] [Upload] [finish(ed)Upload] -> #{result.path}" if self.debug - self.onAfterUpload and self.onAfterUpload.call self, result - self.emit 'afterUpload', result - cb and cb null, result - return # .remove - return # .setTimeout - , 25 - - return # .insert - return # .isServer + result._id = _id + console.info "[FilesCollection] [Upload] [finish(ed)Upload] -> #{result.path}" if self.debug + self.onAfterUpload and self.onAfterUpload.call self, result + self.emit 'afterUpload', result + cb and cb null, result + return + return else undefined ### From d113e11619b20f9439b514ce19f0b59e8845d186 Mon Sep 17 00:00:00 2001 From: dr-dimitru Date: Tue, 24 Jan 2017 05:53:47 +0300 Subject: [PATCH 5/5] v1.7.8 - Fix #327 - Re-fix #324 --- .versions | 2 +- package.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.versions b/.versions index c9898787..7bc2ec09 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.2 -ostrio:files@1.7.7 +ostrio:files@1.7.8 promise@0.8.3 random@1.0.10 reactive-var@1.0.10 diff --git a/package.js b/package.js index caa4cb74..f5b9eba4 100755 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'ostrio:files', - version: '1.7.7', + version: '1.7.8', 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'