mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Comment out not in use old attachments models code.
This commit is contained in:
parent
e72646a4d4
commit
2727651897
2 changed files with 30 additions and 30 deletions
|
@ -1,36 +1,16 @@
|
||||||
import { ReactiveCache } from '/imports/reactiveCache';
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
|
import { Meteor } from 'meteor/meteor';
|
||||||
const storeName = 'attachments';
|
import { FilesCollection } from 'meteor/ostrio:files';
|
||||||
const defaultStoreOptions = {
|
import { isFileValid } from './fileValidation';
|
||||||
beforeWrite: fileObj => {
|
import { createBucket } from './lib/grid/createBucket';
|
||||||
if (!fileObj.isImage()) {
|
import fs from 'fs';
|
||||||
return {
|
import path from 'path';
|
||||||
type: 'application/octet-stream',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
let store;
|
|
||||||
store = 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
|
|
||||||
// appropriate `application/octet-stream` MIME header which can lead to user
|
|
||||||
// data leaks. I imagine other formats (like PDF) can also be attack vectors.
|
|
||||||
// See https://github.com/wekan/wekan/issues/99
|
|
||||||
// XXX Should we use `beforeWrite` option of CollectionFS instead of
|
|
||||||
// collection-hooks?
|
|
||||||
// We should use `beforeWrite`.
|
|
||||||
...defaultStoreOptions,
|
|
||||||
});
|
|
||||||
AttachmentsOld = new FS.Collection('attachments', {
|
|
||||||
stores: [store],
|
|
||||||
});
|
|
||||||
|
|
||||||
if (Meteor.isServer) {
|
if (Meteor.isServer) {
|
||||||
|
AttachmentsOld = createBucket('cfs_gridfs.attachments');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
Meteor.startup(() => {
|
Meteor.startup(() => {
|
||||||
AttachmentsOld.files._ensureIndex({ cardId: 1 });
|
AttachmentsOld.files._ensureIndex({ cardId: 1 });
|
||||||
});
|
});
|
||||||
|
@ -113,6 +93,9 @@ if (Meteor.isServer) {
|
||||||
swimlaneId: doc.swimlaneId,
|
swimlaneId: doc.swimlaneId,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AttachmentsOld;
|
export default AttachmentsOld;
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
import { ReactiveCache } from '/imports/reactiveCache';
|
||||||
|
import { Meteor } from 'meteor/meteor';
|
||||||
|
import { FilesCollection } from 'meteor/ostrio:files';
|
||||||
|
import { isFileValid } from './fileValidation';
|
||||||
|
import { createBucket } from './lib/grid/createBucket';
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
if (Meteor.isServer) {
|
||||||
|
AvatarsOld = createBucket('cfs_gridfs.avatars');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
AvatarsOld = new FS.Collection('avatars', {
|
AvatarsOld = new FS.Collection('avatars', {
|
||||||
stores: [new FS.Store.GridFS('avatars')],
|
stores: [new FS.Store.GridFS('avatars')],
|
||||||
filter: {
|
filter: {
|
||||||
|
@ -26,4 +39,8 @@ AvatarsOld.files.before.insert((userId, doc) => {
|
||||||
doc.userId = userId;
|
doc.userId = userId;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
export default AvatarsOld;
|
export default AvatarsOld;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue