itizawa před 5 roky
rodič
revize
3b26c1e139
1 změnil soubory, kde provedl 4 přidání a 4 odebrání
  1. 4 4
      src/server/middlewares/certify-shared-file.js

+ 4 - 4
src/server/middlewares/certify-shared-file.js

@@ -10,7 +10,7 @@ module.exports = (crowi) => {
     const { path } = url.parse(referer);
     const { path } = url.parse(referer);
 
 
     if (!path.startsWith('/share/')) {
     if (!path.startsWith('/share/')) {
-      next();
+      return next();
     }
     }
 
 
     const fileId = req.params.id || null;
     const fileId = req.params.id || null;
@@ -21,14 +21,14 @@ module.exports = (crowi) => {
     const attachment = await Attachment.findOne({ _id: fileId });
     const attachment = await Attachment.findOne({ _id: fileId });
 
 
     if (attachment == null) {
     if (attachment == null) {
-      next();
+      return next();
     }
     }
 
 
     const shareLinks = await ShareLink.find({ relatedPage: attachment.page });
     const shareLinks = await ShareLink.find({ relatedPage: attachment.page });
 
 
     // If sharelinks don't exist, skip it
     // If sharelinks don't exist, skip it
     if (shareLinks.length === 0) {
     if (shareLinks.length === 0) {
-      next();
+      return next();
     }
     }
 
 
     // Is there a valid share link
     // Is there a valid share link
@@ -40,7 +40,7 @@ module.exports = (crowi) => {
       return;
       return;
     });
     });
 
 
-    next();
+    return next();
   };
   };
 
 
 };
 };