Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid Random.id() on addFile #299

Closed
menelike opened this issue Nov 30, 2016 · 3 comments
Closed

Avoid Random.id() on addFile #299

menelike opened this issue Nov 30, 2016 · 3 comments

Comments

@menelike
Copy link
Contributor

I think its reasonable to switch from Random.id() to _id as a part of the insert callback.
https://github.com/VeliovGroup/Meteor-Files/blob/master/files.coffee#L1412

Moreover, it should be noted that fileRef in the callback of addFile is not the inserted document like described in https://github.com/VeliovGroup/Meteor-Files/blob/dd59d886db69e8d74db3ebb5e1c7bde74f0b64c9/docs/addFile.md

callback {Function} - Triggered after new record is added to Collection. With error, and fileRef, where fileRef is a new record from DB

Instead it's a predicted document, as data is not fetched from the database after insert. This may also fail on the next calls like proceedAfterUpload. We subclass collection.insert and add some extra fields like timestamps, in those cases we findOne(fileRef._id) to fetch the real document) and pass it to proceedAfterUpload on callback.

dr-dimitru added a commit that referenced this issue Dec 12, 2016
@dr-dimitru
Copy link
Member

dr-dimitru commented Dec 12, 2016

Hello @menelike ,

Updated in 8185673 an in 6e0b3a9

Please, check it on your end

@menelike
Copy link
Contributor Author

@dr-dimitru works like a charm. Thanks a lot, like always, great work/support!

dr-dimitru added a commit that referenced this issue Dec 15, 2016
 - NPM dependencies update
 - Support for updated *Buffer* API on node >= 6.*
 - Methods `addFile`, `write` and `load` now supports `userId` option,
see #305
 - Fix for unfinished uploads, now files is removed by upload TTL. See
#267, thanks to @ck23onGithub
 - Better FS-stream management on server. Less memory and CPU
consumption. Only one descriptor per upload. Fix FS-permissions
 - `.unlink()` method now supports callback
 - Docs for [MUP/Docker
integration](https://github.com/VeliovGroup/Meteor-Files/wiki/MeteorUp-(
MUP)-Usage)
 - Fix #293
 - Fix #299
 - BEtter AWS dos, see #282
 - `storagePath` now always is function, if *String* is passed - it
will be wrapped into function
 - Please participate at [this
thread](#309) to give
a right path for Meteor-Files v2.0
@dr-dimitru dr-dimitru mentioned this issue Dec 15, 2016
dr-dimitru added a commit that referenced this issue Dec 15, 2016
v1.7.6
 - NPM dependencies update
 - Support for updated *Buffer* API on node >= 6.*
 - Methods `addFile`, `write` and `load` now supports `userId` option, see #305
 - Fix for unfinished uploads, now files is removed by upload TTL. See #267, thanks to @ck23onGithub
 - Better FS-stream management on server. Less memory and CPU consumption. Only one descriptor per upload. Fix FS-permissions
 - `.unlink()` method now supports callback
 - Docs for [MUP/Docker integration](https://github.com/VeliovGroup/Meteor-Files/wiki/MeteorUp-(MUP)-Usage)
 - Fix #293
 - Fix #299
 - BEtter AWS dos, see #282
 - `storagePath` now always is function, if *String* is passed - it will be wrapped into function
 - Please participate at [this thread](#309) to give a right path for Meteor-Files v2.0
@dr-dimitru
Copy link
Member

Published as v1.7.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants