nav tabs on admin dashboard
This commit is contained in:
13
node_modules/connect-history-api-fallback/lib/index.js
generated
vendored
13
node_modules/connect-history-api-fallback/lib/index.js
generated
vendored
@@ -50,6 +50,17 @@ exports = module.exports = function historyApiFallback(options) {
|
||||
var match = parsedUrl.pathname.match(rewrite.from);
|
||||
if (match !== null) {
|
||||
rewriteTarget = evaluateRewriteRule(parsedUrl, match, rewrite.to, req);
|
||||
|
||||
if(rewriteTarget.charAt(0) !== '/') {
|
||||
logger(
|
||||
'We recommend using an absolute path for the rewrite target.',
|
||||
'Received a non-absolute rewrite target',
|
||||
rewriteTarget,
|
||||
'for URL',
|
||||
req.url
|
||||
);
|
||||
}
|
||||
|
||||
logger('Rewriting', req.method, req.url, 'to', rewriteTarget);
|
||||
req.url = rewriteTarget;
|
||||
return next();
|
||||
@@ -79,7 +90,7 @@ function evaluateRewriteRule(parsedUrl, match, rule, req) {
|
||||
if (typeof rule === 'string') {
|
||||
return rule;
|
||||
} else if (typeof rule !== 'function') {
|
||||
throw new Error('Rewrite rule can only be of type string of function.');
|
||||
throw new Error('Rewrite rule can only be of type string or function.');
|
||||
}
|
||||
|
||||
return rule({
|
||||
|
||||
Reference in New Issue
Block a user