Skip to content

Commit

Permalink
Removing regex.dir
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Jan 12, 2019
1 parent b945dbb commit 5a0ca83
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ function file (req, res, next) {
req.file = {path: lpath, stats: stats};
req.server.log("Routed request to disk", "debug");
next();
} else if (canGet(req.method) === true && regex.dir.test(req.parsed.pathname) === false) {
res.redirect((req.parsed.pathname !== "/" ? req.parsed.pathname : "") + "/" + req.parsed.search);
} else if (canGet(req.method) === true && req.parsed.pathname.endsWith("/") === false) {
res.redirect(`${req.parsed.pathname}/${req.parsed.search}`);
} else {
const nth = req.server.config.index.length;
let count = 0,
Expand Down
2 changes: 0 additions & 2 deletions lib/regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ module.exports = {
bodySplit: /&|=/,
compress: /(javascript|json|text|xml|yaml)/,
collection: /(.*)(\/.*)$/,
def: /deflate/,
dir: /\/$/,
hasParam: /\/:\w*/,
hypermedia: /(([a-z]+(_)?)?id|url|uri)$/i,
id: /^_?id$/i,
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tenso",
"description": "Tensō is an HTTP/HTTP2 REST API framework",
"version": "10.0.28",
"version": "10.0.29",
"homepage": "http://avoidwork.github.io/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down

0 comments on commit 5a0ca83

Please sign in to comment.