itizawa 5 lat temu
rodzic
commit
3b26c1e139
1 zmienionych plików z 4 dodań i 4 usunięć
  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);
 
     if (!path.startsWith('/share/')) {
-      next();
+      return next();
     }
 
     const fileId = req.params.id || null;
@@ -21,14 +21,14 @@ module.exports = (crowi) => {
     const attachment = await Attachment.findOne({ _id: fileId });
 
     if (attachment == null) {
-      next();
+      return next();
     }
 
     const shareLinks = await ShareLink.find({ relatedPage: attachment.page });
 
     // If sharelinks don't exist, skip it
     if (shareLinks.length === 0) {
-      next();
+      return next();
     }
 
     // Is there a valid share link
@@ -40,7 +40,7 @@ module.exports = (crowi) => {
       return;
     });
 
-    next();
+    return next();
   };
 
 };