Comparing version 5.1.2 to 5.1.3
@@ -30,13 +30,4 @@ 'use strict'; | ||
internals.normalizePaths = function (basePath, paths) { | ||
internals.resolvePathOption = function (result) { | ||
return paths.map((path) => { | ||
return Path.isAbsolute(path) ? path : Path.join(basePath, path); | ||
}); | ||
}; | ||
internals.resolvePathOption = function (basePath, result) { | ||
if (result instanceof Error) { | ||
@@ -46,14 +37,11 @@ throw result; | ||
let paths; | ||
if (typeof result === 'string') { | ||
paths = [result]; | ||
return [result]; | ||
} | ||
else if (Array.isArray(result)) { | ||
paths = result; | ||
if (Array.isArray(result)) { | ||
return result; | ||
} | ||
else { | ||
throw Boom.internal('Invalid path function'); | ||
} | ||
return internals.normalizePaths(basePath, paths); | ||
throw Boom.internal('Invalid path function'); | ||
}; | ||
@@ -69,3 +57,4 @@ | ||
const basePath = route.settings.files.relativeTo; | ||
const normalized = (Array.isArray(settings.path) ? internals.normalizePaths(basePath, settings.path) : null); // Array or function | ||
const normalized = (Array.isArray(settings.path) ? settings.path : null); // Array or function | ||
const indexNames = (settings.index === true) ? ['index.html'] : (settings.index || []); | ||
@@ -77,3 +66,3 @@ | ||
const paths = normalized || internals.resolvePathOption(basePath, settings.path.call(null, request)); | ||
const paths = normalized || internals.resolvePathOption(settings.path.call(null, request)); | ||
@@ -159,3 +148,3 @@ // Append parameter | ||
if (settings.listing) { | ||
return internals.generateListing(Path.join(baseDir, path), resource, selection, hasTrailingSlash, settings, request); | ||
return internals.generateListing(Path.join(basePath, baseDir, path), resource, selection, hasTrailingSlash, settings, request); | ||
} | ||
@@ -214,3 +203,3 @@ } | ||
html = html + '<li><a href="' + internals.pathEncode(resource + (selection && !hasTrailingSlash ? '/' : '') + files[i]) + '">' + Hoek.escapeHtml(files[i]) + '</a></li>'; | ||
html = html + '<li><a href="' + internals.pathEncode(resource + (!hasTrailingSlash ? '/' : '') + files[i]) + '">' + Hoek.escapeHtml(files[i]) + '</a></li>'; | ||
} | ||
@@ -217,0 +206,0 @@ } |
{ | ||
"name": "inert", | ||
"description": "Static file and directory handlers plugin for hapi.js", | ||
"version": "5.1.2", | ||
"version": "5.1.3", | ||
"repository": "https://github.com/hapijs/inert.git", | ||
@@ -24,4 +24,4 @@ "main": "lib/index.js", | ||
"code": "5.x.x", | ||
"hapi": "17.x.x", | ||
"lab": "17.x.x" | ||
"hapi": "18.x.x", | ||
"lab": "18.x.x" | ||
}, | ||
@@ -28,0 +28,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
35383
10
532