فهرست منبع

Fix checking if API is enabled

Justin Reynolds 5 سال پیش
والد
کامیت
7a60eef375
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      models/users.js

+ 2 - 2
models/users.js

@@ -946,8 +946,8 @@ if (Meteor.isServer) {
 if (Meteor.isServer) {
   // Middleware which checks that API is enabled.
   JsonRoutes.Middleware.use(function(req, res, next) {
-    const api = req.url.search('api');
-    if ((api === 1 && process.env.WITH_API === 'true') || api === -1) {
+    const api = req.url.startsWith('/api');
+    if ((api === true && process.env.WITH_API === 'true') || api === false) {
       return next();
     } else {
       res.writeHead(301, { Location: '/' });