瀏覽代碼

BugFix for getFilePathOnStorage of local.js

Yuki Takei 7 年之前
父節點
當前提交
82035ee07a
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      src/server/service/file-uploader/local.js

+ 5 - 3
src/server/service/file-uploader/local.js

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