Yuki Takei 2 лет назад
Родитель
Сommit
5caf7baa1a

+ 0 - 1
apps/app/src/server/models/attachment.ts

@@ -36,7 +36,6 @@ export interface IAttachmentModel extends Model<IAttachmentDocument> {
 const attachmentSchema = new Schema({
 const attachmentSchema = new Schema({
   page: { type: Types.ObjectId, ref: 'Page', index: true },
   page: { type: Types.ObjectId, ref: 'Page', index: true },
   creator: { type: Types.ObjectId, ref: 'User', index: true },
   creator: { type: Types.ObjectId, ref: 'User', index: true },
-  filePath: { type: String }, // DEPRECATED: remains for backward compatibility for v3.3.x or below
   fileName: { type: String, required: true, unique: true },
   fileName: { type: String, required: true, unique: true },
   fileFormat: { type: String, required: true },
   fileFormat: { type: String, required: true },
   fileSize: { type: Number, default: 0 },
   fileSize: { type: Number, default: 0 },

+ 1 - 5
apps/app/src/server/service/file-uploader/gridfs.ts

@@ -87,11 +87,7 @@ module.exports = function(crowi) {
   };
   };
 
 
   (lib as any).deleteFile = async function(attachment) {
   (lib as any).deleteFile = async function(attachment) {
-    let filenameValue = attachment.fileName;
-
-    if (attachment.filePath != null) { // backward compatibility for v3.3.x or below
-      filenameValue = attachment.filePath;
-    }
+    const filenameValue = attachment.fileName;
 
 
     const attachmentFile = await AttachmentFile.findOne({ filename: filenameValue });
     const attachmentFile = await AttachmentFile.findOne({ filename: filenameValue });
 
 

+ 4 - 10
apps/app/src/server/service/file-uploader/local.js

@@ -20,16 +20,10 @@ module.exports = function(crowi) {
   const basePath = path.posix.join(crowi.publicDir, 'uploads');
   const basePath = path.posix.join(crowi.publicDir, 'uploads');
 
 
   function getFilePathOnStorage(attachment) {
   function getFilePathOnStorage(attachment) {
-    let filePath;
-    if (attachment.filePath != null) { // backward compatibility for v3.3.x or below
-      filePath = path.posix.join(basePath, attachment.filePath);
-    }
-    else {
-      const dirName = (attachment.page != null)
-        ? 'attachment'
-        : 'user';
-      filePath = path.posix.join(basePath, dirName, attachment.fileName);
-    }
+    const dirName = (attachment.page != null)
+      ? 'attachment'
+      : 'user';
+    const filePath = path.posix.join(basePath, dirName, attachment.fileName);
 
 
     return filePath;
     return filePath;
   }
   }