From 2727651897ae082113e7d0b3c73a561135d4605b Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Sun, 8 Sep 2024 17:42:04 +0300 Subject: [PATCH] Comment out not in use old attachments models code. --- models/attachments_old.js | 43 ++++++++++++--------------------------- models/avatars_old.js | 17 ++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/models/attachments_old.js b/models/attachments_old.js index fae4b844c..7110b4a70 100644 --- a/models/attachments_old.js +++ b/models/attachments_old.js @@ -1,36 +1,16 @@ import { ReactiveCache } from '/imports/reactiveCache'; - -const storeName = 'attachments'; -const defaultStoreOptions = { - beforeWrite: fileObj => { - if (!fileObj.isImage()) { - return { - 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], -}); +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) { + AttachmentsOld = createBucket('cfs_gridfs.attachments'); + +/* + Meteor.startup(() => { AttachmentsOld.files._ensureIndex({ cardId: 1 }); }); @@ -113,6 +93,9 @@ if (Meteor.isServer) { swimlaneId: doc.swimlaneId, }); }); + +*/ + } export default AttachmentsOld; diff --git a/models/avatars_old.js b/models/avatars_old.js index deae4bbc6..f7f561df7 100644 --- a/models/avatars_old.js +++ b/models/avatars_old.js @@ -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', { stores: [new FS.Store.GridFS('avatars')], filter: { @@ -26,4 +39,8 @@ AvatarsOld.files.before.insert((userId, doc) => { doc.userId = userId; }); +*/ + +}; + export default AvatarsOld;