Prechádzať zdrojové kódy

Attachment, rename not needed anymore since Meteor-Files 2.3.0

Thanks to @dr-dimitru
https://github.com/wekan/wekan/pull/4638#issuecomment-1217883870

https://github.com/veliovgroup/Meteor-Files/commit/00ab6f723b84eb596b366c5d26e6981a00377809
Martin Filser 2 rokov pred
rodič
commit
f6fbd0a5c2
3 zmenil súbory, kde vykonal 9 pridanie a 4 odobranie
  1. 1 1
      .meteor/packages
  2. 4 3
      models/attachments.js
  3. 4 0
      models/avatars.js

+ 1 - 1
.meteor/packages

@@ -81,7 +81,7 @@ konecty:mongo-counter
 percolate:synced-cron
 cfs:filesystem
 ostrio:cookies
-ostrio:files@2.0.1
+ostrio:files@2.3.0
 rajit:bootstrap3-datepicker-fi
 rajit:bootstrap3-datepicker-ar
 rajit:bootstrap3-datepicker-bg

+ 4 - 3
models/attachments.js

@@ -76,6 +76,10 @@ Attachments = new FilesCollection({
     // remove fileId from meta, it was only stored there to have this information here in the namingFunction function
     return ret;
   },
+  sanitize(str, max, replacement) {
+    // keep the original filename
+    return str;
+  },
   storagePath() {
     const ret = fileStoreStrategyFactory.storagePath;
     return ret;
@@ -141,9 +145,6 @@ if (Meteor.isServer) {
 
       const fileObj = Attachments.findOne({_id: fileObjId});
       moveToStorage(fileObj, storageDestination, fileStoreStrategyFactory);
-
-      // since Meteor-Files 2.1.0 the filename is truncated to 28 characters, so rename the file after upload to the right filename back
-      rename(fileObj, fileObj.name, fileStoreStrategyFactory);
     },
     renameAttachment(fileObjId, newName) {
       check(fileObjId, String);

+ 4 - 0
models/avatars.js

@@ -45,6 +45,10 @@ Avatars = new FilesCollection({
   debug: false, // Change to `true` for debugging
   collectionName: 'avatars',
   allowClientCode: true,
+  sanitize(str, max, replacement) {
+    // keep the original filename
+    return str;
+  },
   storagePath() {
     const ret = fileStoreStrategyFactory.storagePath;
     return ret;