zamis 5 лет назад
Родитель
Сommit
6c40dec96b
2 измененных файлов с 5 добавлено и 3 удалено
  1. 2 0
      src/server/service/attachment.js
  2. 3 3
      src/server/service/file-uploader/gridfs.js

+ 2 - 0
src/server/service/attachment.js

@@ -53,6 +53,8 @@ class AttachmentService {
       unorderAttachmentsBulkOp.find({ _id: attachment._id }).remove();
     });
 
+    // await fileUploadService.deleteFile.unorderFilesCollection.execute();
+    // await fileUploadService.deleteFile.unorderChunkCollection.execute();
     return unorderAttachmentsBulkOp.execute();
   }
 

+ 3 - 3
src/server/service/file-uploader/gridfs.js

@@ -38,10 +38,10 @@ module.exports = function(crowi) {
     const attachmentFile = await AttachmentFile.findOne({ filename: filenameValue });
 
     const fileId = attachmentFile._id;
-    const fileName = attachmentFile.fileName;
-
+    const filename = attachmentFile.filename;
+    console.log(filename);
     unorderChunkCollection.find({ files_id: fileId }).remove();
-    unorderFilesCollection.find({ fileName }).remove();
+    unorderFilesCollection.find({ filename }).remove();
 
     if (attachmentFile == null) {
       logger.warn(`Any AttachmentFile that relate to the Attachment (${attachment._id.toString()}) does not exist in GridFS`);