Browse Source

Comment out not in use old attachments models code.

Lauri Ojansivu 9 months ago
parent
commit
2727651897
2 changed files with 30 additions and 30 deletions
  1. 13 30
      models/attachments_old.js
  2. 17 0
      models/avatars_old.js

+ 13 - 30
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;

+ 17 - 0
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;