Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async execute(i: Readonly): Promise {
const isFile = !!mime.lookup(i.ctx.path)
const route = i.ctx.routes.find(x => x.action.decorators.some(x => x.type === "HistoryApiFallback"))
//no context.route = no controller = no handler
if (!i.ctx.route && i.ctx.state.caller === "system" && !isFile && !!route && i.ctx.request.method === "GET" && i.ctx.request.accepts("html")) {
return invoke(i.ctx, route)
}
else
return i.proceed()
}
}