serve-handler
Advanced tools
Comparing version 2.4.1 to 3.0.0
{ | ||
"name": "serve-handler", | ||
"version": "2.4.1", | ||
"version": "3.0.0", | ||
"description": "The routing foundation of `serve` and static deployments on Now", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -52,3 +52,3 @@ # serve-handler | ||
| [`public`](#public-boolean) | Set a sub directory to be served | | ||
| [`cleanUrls`](#cleanurls-booleanarray) | Have `.html` and `.htm` extension stripped from paths | | ||
| [`cleanUrls`](#cleanurls-booleanarray) | Have the `.html` extension stripped from paths | | ||
| [`rewrites`](#rewrites-array) | Rewrite paths to different paths | | ||
@@ -77,3 +77,3 @@ | [`redirects`](#redirects-array) | Forward paths to different paths or external URLs | | ||
By default, all `.html` and `.htm` files can be accessed without their extension. | ||
By default, all `.html` files can be accessed without their extension. | ||
@@ -80,0 +80,0 @@ If one of these extensions is used at the end of a filename, it will automatically perform a redirect with status code [301](https://en.wikipedia.org/wiki/HTTP_301) to the same path, but with the extension dropped. |
@@ -106,3 +106,3 @@ // Native | ||
const defaultType = 301; | ||
const matchHTML = /(\.html|\.htm|\/index)$/g; | ||
const matchHTML = /(\.html|\/index)$/g; | ||
@@ -239,4 +239,4 @@ let cleanedUrl = false; | ||
const findRelated = async (current, relativePath, rewrittenPath, originalStat, extension = '.html') => { | ||
const possible = rewrittenPath ? [rewrittenPath] : getPossiblePaths(relativePath, extension); | ||
const findRelated = async (current, relativePath, rewrittenPath, originalStat) => { | ||
const possible = rewrittenPath ? [rewrittenPath] : getPossiblePaths(relativePath, '.html'); | ||
@@ -265,9 +265,3 @@ let stats = null; | ||
if (extension === '.htm') { | ||
return null; | ||
} | ||
// At this point, no `.html` files have been found, so we | ||
// need to check for the existance of `.htm` ones. | ||
return findRelated(current, relativePath, rewrittenPath, originalStat, '.htm'); | ||
return null; | ||
}; | ||
@@ -274,0 +268,0 @@ |
31185
454