Skip to content

Commit

Permalink
Changes package version to 0.7.4
Browse files Browse the repository at this point in the history
Adds method `UploadFS.addStore(store)`
Fixes #113
  • Loading branch information
jalik committed Feb 15, 2017
1 parent 3eaf2c2 commit f4fc986
Show file tree
Hide file tree
Showing 7 changed files with 285 additions and 273 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,10 @@ Some helpers are available by default to help you work with files inside templat

## Changelog

### Version 0.7.4
**Security fix, please upgrade as soon as possible**
- Fixes store callback events not being called : `onCopyError`, `onFinishUpload`, `onRead`, `onReadError`, `onWriteError`

### Version 0.7.3
- Bypasses collection permissions check when calling version upgrade methods

Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

Package.describe({
name: "jalik:ufs",
version: "0.7.3",
version: "0.7.4",
author: "[email protected]",
summary: "Base package for UploadFS",
homepage: "https://github.com/jalik/jalik-ufs",
Expand Down
89 changes: 46 additions & 43 deletions ufs-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
* SOFTWARE.
*
*/

import {_} from 'meteor/underscore';
import {Meteor} from 'meteor/meteor';
import {_} from "meteor/underscore";
import {Meteor} from "meteor/meteor";


/**
Expand All @@ -33,13 +32,15 @@ import {Meteor} from 'meteor/meteor';
export class Filter {

constructor(options) {
const self = this;

// Default options
options = _.extend({
contentTypes: null,
extensions: null,
minSize: 1,
maxSize: 0,
onCheck: null
onCheck: this.onCheck
}, options);

// Check options
Expand All @@ -59,45 +60,15 @@ export class Filter {
throw new TypeError("Filter: onCheck is not a function");
}

// Private attributes
let contentTypes = options.contentTypes;
let extensions = options.extensions;
let maxSize = parseInt(options.maxSize);
let minSize = parseInt(options.minSize);

this.onCheck = options.onCheck;

/**
* Returns the allowed content types
* @return {Array}
*/
this.getContentTypes = () => {
return contentTypes;
};

/**
* Returns the allowed extensions
* @return {Array}
*/
this.getExtensions = () => {
return extensions;
};

/**
* Returns the maximum file size
* @return {Number}
*/
this.getMaxSize = () => {
return maxSize;
};

/**
* Returns the minimum file size
* @return {Number}
*/
this.getMinSize = () => {
return minSize;
};
// Public attributes
self.options = options;
_.each([
'onCheck'
], (method) => {
if (typeof options[method] === 'function') {
self[method] = options[method];
}
});
}

/**
Expand Down Expand Up @@ -129,6 +100,38 @@ export class Filter {
}
}

/**
* Returns the allowed content types
* @return {Array}
*/
getContentTypes() {
return this.options.contentTypes;
}

/**
* Returns the allowed extensions
* @return {Array}
*/
getExtensions() {
return this.options.extensions;
}

/**
* Returns the maximum file size
* @return {Number}
*/
getMaxSize() {
return this.options.maxSize;
}

/**
* Returns the minimum file size
* @return {Number}
*/
getMinSize() {
return this.options.minSize;
}

/**
* Checks if content type is in the given list
* @param type
Expand Down
11 changes: 5 additions & 6 deletions ufs-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
* SOFTWARE.
*
*/

import {_} from 'meteor/underscore';
import {Meteor} from 'meteor/meteor';
import {WebApp} from 'meteor/webapp';
import {UploadFS} from './ufs';
import {_} from "meteor/underscore";
import {Meteor} from "meteor/meteor";
import {WebApp} from "meteor/webapp";
import {UploadFS} from "./ufs";


if (Meteor.isServer) {
Expand Down Expand Up @@ -209,7 +208,7 @@ if (Meteor.isServer) {
}

if (store.onRead !== null && store.onRead !== undefined && typeof store.onRead !== 'function') {
console.error(`ufs: store "${storeName}" onRead is not a function`);
console.error(`ufs: Store.onRead is not a function in store "${storeName}"`);
res.writeHead(500);
res.end();
return;
Expand Down
4 changes: 2 additions & 2 deletions ufs-store-permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
* SOFTWARE.
*
*/

import {_} from 'meteor/underscore';
import {_} from "meteor/underscore";


/**
Expand All @@ -50,6 +49,7 @@ export class StorePermissions {
throw new TypeError("StorePermissions: update is not a function");
}

// Public attributes
this.actions = {
insert: options.insert,
remove: options.remove,
Expand Down
Loading

0 comments on commit f4fc986

Please sign in to comment.