mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 04:57:07 -04:00
Merge pull request #2588 from justinr1234/fix-api-parser
Fix checking if API is enabled
This commit is contained in:
commit
778759b8ca
1 changed files with 2 additions and 2 deletions
|
@ -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: '/' });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue