Skip to content

Commit

Permalink
Merge pull request #636 from VeliovGroup/dev
Browse files Browse the repository at this point in the history
v1.10.2
  • Loading branch information
dr-dimitru authored Aug 16, 2018
2 parents 35280e0 + cf2d8ac commit fdd03a5
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 42 deletions.
53 changes: 29 additions & 24 deletions .npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions client.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ export class FilesCollection extends FilesCollectionCore {

try {
const _URL = window.URL || window.webkitURL || window.mozURL || window.msURL || window.oURL || false;
if (window.Worker && window.Blob && _URL) {
if (window.Worker && window.Blob && _URL && helpers.isFunction(_URL.createObjectURL)) {
this._supportWebWorker = true;
this._webWorkerUrl = _URL.createObjectURL(new Blob(['!function(a){"use strict";a.onmessage=function(b){var c=b.data.f.slice(b.data.cs*(b.data.cc-1),b.data.cs*b.data.cc);if(b.data.ib===!0)postMessage({bin:c,chunkId:b.data.cc});else{var d;a.FileReader?(d=new FileReader,d.onloadend=function(a){postMessage({bin:(d.result||a.srcElement||a.target).split(",")[1],chunkId:b.data.cc,s:b.data.s})},d.onerror=function(a){throw(a.target||a.srcElement).error},d.readAsDataURL(c)):a.FileReaderSync?(d=new FileReaderSync,postMessage({bin:d.readAsDataURL(c).split(",")[1],chunkId:b.data.cc})):postMessage({bin:null,chunkId:b.data.cc,error:"File API is not supported in WebWorker!"})}}}(this);'], {type: 'application/javascript'}));
this._webWorkerUrl = _URL.createObjectURL(new window.Blob(['!function(a){"use strict";a.onmessage=function(b){var c=b.data.f.slice(b.data.cs*(b.data.cc-1),b.data.cs*b.data.cc);if(b.data.ib===!0)postMessage({bin:c,chunkId:b.data.cc});else{var d;a.FileReader?(d=new FileReader,d.onloadend=function(a){postMessage({bin:(d.result||a.srcElement||a.target).split(",")[1],chunkId:b.data.cc,s:b.data.s})},d.onerror=function(a){throw(a.target||a.srcElement).error},d.readAsDataURL(c)):a.FileReaderSync?(d=new FileReaderSync,postMessage({bin:d.readAsDataURL(c).split(",")[1],chunkId:b.data.cc})):postMessage({bin:null,chunkId:b.data.cc,error:"File API is not supported in WebWorker!"})}}}(this);'], {type: 'application/javascript'}));
} else if (window.Worker) {
this._supportWebWorker = true;
this._webWorkerUrl = Meteor.absoluteUrl('packages/ostrio_files/worker.min.js');
Expand Down
4 changes: 2 additions & 2 deletions core.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default class FilesCollectionCore extends EventEmitter {
*/
_debug() {
if (this.debug) {
(console.info || console.log || function () { }).apply(undefined, arguments);
(console.info || console.log || function () { }).apply(void 0, arguments);
}
}

Expand Down Expand Up @@ -262,7 +262,7 @@ export default class FilesCollectionCore extends EventEmitter {
* @returns {String} Empty string returned in case if file not found in DB
*/
link(fileRef, version = 'original', URIBase) {
this._debug(`[FilesCollection] [link(${(helpers.isObject(fileRef) ? fileRef._id : undefined)}, ${version})]`);
this._debug(`[FilesCollection] [link(${(helpers.isObject(fileRef) ? fileRef._id : void 0)}, ${version})]`);
check(fileRef, Object);

if (!fileRef) {
Expand Down
6 changes: 3 additions & 3 deletions package.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Package.describe({
name: 'ostrio:files',
version: '1.10.1',
version: '1.10.2',
summary: 'File upload via DDP/HTTP to server, 3rd party storage support: AWS S3, GridFS, DropBox and others',
git: 'https://github.com/VeliovGroup/Meteor-Files',
documentation: 'README.md'
});

Npm.depends({
'fs-extra': '7.0.0',
'request': '2.87.0',
'file-type': '8.1.0',
'request': '2.88.0',
'file-type': '9.0.0',
'eventemitter3': '3.1.0'
});

Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@ export class FilesCollection extends FilesCollectionCore {
*/
remove(selector, callback) {
this._debug(`[FilesCollection] [remove(${JSON.stringify(selector)})]`);
if (selector === undefined) {
if (selector === void 0) {
return 0;
}
check(callback, Match.Optional(Function));
Expand Down
12 changes: 6 additions & 6 deletions upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export class UploadInstance extends EventEmitter {
HTTP.call('POST', `${_rootUrl}${this.collection.downloadRoute}/${this.collection.collectionName}/__upload`, {
content: opts.binData,
headers: {
'x-mtok': (helpers.isObject(Meteor.connection) ? Meteor.connection._lastSessionId : undefined) || null,
'x-mtok': (helpers.isObject(Meteor.connection) ? Meteor.connection._lastSessionId : void 0) || null,
'x-fileid': opts.fileId,
'x-chunkid': opts.chunkId,
'content-type': 'text/plain'
Expand Down Expand Up @@ -420,14 +420,14 @@ export class UploadInstance extends EventEmitter {
content: '',
headers: {
'x-eof': '1',
'x-mtok': (helpers.isObject(Meteor.connection) ? Meteor.connection._lastSessionId : undefined) || null,
'x-mtok': (helpers.isObject(Meteor.connection) ? Meteor.connection._lastSessionId : void 0) || null,
'x-fileId': opts.fileId,
'content-type': 'text/plain'
}
}, (error, _result) => {
let result;
try {
result = JSON.parse((helpers.isObject(_result) ? _result.content : undefined) || {});
result = JSON.parse((helpers.isObject(_result) ? _result.content : void 0) || {});
} catch (e) {
console.warn('Something went wrong! [sendEOF] method doesn\'t returned JSON! Looks like you\'re on Cordova app or behind proxy, switching to DDP transport is recommended.');
result = {};
Expand Down Expand Up @@ -461,7 +461,7 @@ export class UploadInstance extends EventEmitter {
fileReader.onloadend = (evt) => {
this.emit('sendChunk', {
data: {
bin: ((helpers.isObject(fileReader) ? fileReader.result : undefined) || (evt.srcElement ? evt.srcElement.result : undefined) || (evt.target ? evt.target.result : undefined)).split(',')[1],
bin: ((helpers.isObject(fileReader) ? fileReader.result : void 0) || (evt.srcElement ? evt.srcElement.result : void 0) || (evt.target ? evt.target.result : void 0)).split(',')[1],
chunkId
}
});
Expand Down Expand Up @@ -598,15 +598,15 @@ export class UploadInstance extends EventEmitter {
if (this.config.transport === 'ddp') {
this.config.ddp.call(this.collection._methodNames._Start, opts, handleStart);
} else {
if (helpers.isObject(opts.file) ? opts.file.meta : undefined) {
if (helpers.isObject(opts.file) ? opts.file.meta : void 0) {
opts.file.meta = fixJSONStringify(opts.file.meta);
}

HTTP.call('POST', `${_rootUrl}${this.collection.downloadRoute}/${this.collection.collectionName}/__upload`, {
data: opts,
headers: {
'x-start': '1',
'x-mtok': (helpers.isObject(Meteor.connection) ? Meteor.connection._lastSessionId : undefined) || null
'x-mtok': (helpers.isObject(Meteor.connection) ? Meteor.connection._lastSessionId : void 0) || null
}
}, handleStart);
}
Expand Down

0 comments on commit fdd03a5

Please sign in to comment.