summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.meteor/packages1
-rw-r--r--.meteor/versions1
-rw-r--r--client/components/cards/attachments.js3
-rw-r--r--models/attachments.js39
-rwxr-xr-xsnap-src/bin/config4
5 files changed, 33 insertions, 15 deletions
diff --git a/.meteor/packages b/.meteor/packages
index eb0c10f1..f234baea 100644
--- a/.meteor/packages
+++ b/.meteor/packages
@@ -95,3 +95,4 @@ wekan-markdown
konecty:mongo-counter
percolate:synced-cron
easylogic:summernote
+cfs:filesystem
diff --git a/.meteor/versions b/.meteor/versions
index 70478a3c..d1a869ee 100644
--- a/.meteor/versions
+++ b/.meteor/versions
@@ -30,6 +30,7 @@ cfs:collection@0.5.5
cfs:collection-filters@0.2.4
cfs:data-man@0.0.6
cfs:file@0.1.17
+cfs:filesystem@0.1.2
cfs:gridfs@0.0.34
cfs:http-methods@0.0.32
cfs:http-publish@0.0.13
diff --git a/client/components/cards/attachments.js b/client/components/cards/attachments.js
index 2cf68c59..d60169c3 100644
--- a/client/components/cards/attachments.js
+++ b/client/components/cards/attachments.js
@@ -66,6 +66,9 @@ Template.cardAttachmentsPopup.events({
file.cardId = card._id;
}
file.userId = Meteor.userId();
+ if (file.original) {
+ file.original.name = f.name;
+ }
const attachment = Attachments.insert(file);
if (attachment && attachment._id && attachment.isImage()) {
diff --git a/models/attachments.js b/models/attachments.js
index 0616c79f..95265422 100644
--- a/models/attachments.js
+++ b/models/attachments.js
@@ -1,8 +1,23 @@
-Attachments = new FS.Collection('attachments', {
- stores: [
- // XXX Add a new store for cover thumbnails so we don't load big images in
- // the general board view
- new FS.Store.GridFS('attachments', {
+const localFSStore = process.env.ATTACHMENTS_STORE_PATH;
+const storeName = 'attachments';
+const defaultStoreOptions = {
+ beforeWrite: fileObj => {
+ if (!fileObj.isImage()) {
+ return {
+ type: 'application/octet-stream',
+ };
+ }
+ return {};
+ },
+};
+const Store = localFSStore
+ ? new FS.Store.FileSystem(storeName, {
+ path: localFSStore,
+ ...defaultStoreOptions,
+ })
+ : new FS.Store.GridFS(storeName, {
+ // XXX Add a new store for cover thumbnails so we don't load big images in
+ // the general board view
// If the uploaded document is not an image we need to enforce browser
// download instead of execution. This is particularly important for HTML
// files that the browser will just execute if we don't serve them with the
@@ -12,16 +27,10 @@ Attachments = new FS.Collection('attachments', {
// XXX Should we use `beforeWrite` option of CollectionFS instead of
// collection-hooks?
// We should use `beforeWrite`.
- beforeWrite: fileObj => {
- if (!fileObj.isImage()) {
- return {
- type: 'application/octet-stream',
- };
- }
- return {};
- },
- }),
- ],
+ ...defaultStoreOptions,
+ });
+Attachments = new FS.Collection('attachments', {
+ stores: [Store],
});
if (Meteor.isServer) {
diff --git a/snap-src/bin/config b/snap-src/bin/config
index fe2860db..63a95d19 100755
--- a/snap-src/bin/config
+++ b/snap-src/bin/config
@@ -88,6 +88,10 @@ DESCRIPTION_ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW="Accounts lockout unkn
DEFAULT_ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW="15"
KEY_ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW="accounts-lockout-unknown-users-failure-window"
+DESCRIPTION_ATTACHMENTS_STORE_PATH="Allow wekan ower to specify where uploaded files to store on the server instead of the mongodb"
+DEFAULT_ATTACHMENTS_STORE_PATH=""
+KEY_ATTACHMENTS_STORE_PATH="attachments-store-path"
+
DESCRIPTION_MAX_IMAGE_PIXEL="Max image pixel: Allow to shrink attached/pasted image https://github.com/wekan/wekan/pull/2544"
DEFAULT_MAX_IMAGE_PIXEL=""
KEY_MAX_IMAGE_PIXEL="max-image-pixel"