Comparing version 1.1.0 to 1.1.1
@@ -232,3 +232,3 @@ // Load modules | ||
return /^\./.test(Path.basename(path)); | ||
return /(^|[\\\/])\.([^\\\/]|[\\\/]?$)/.test(path); // Starts with a '.' or contains '/.' or '\.', and not followed by a '/' or '\' or end | ||
}; | ||
@@ -235,0 +235,0 @@ |
{ | ||
"name": "inert", | ||
"description": "Static file and directory handlers for hapi.js", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"repository": "git://github.com/hapijs/inert", | ||
@@ -6,0 +6,0 @@ "main": "index", |
@@ -277,3 +277,3 @@ // Load modules | ||
it('returns the index when found in hidden folder', function (done) { | ||
it('returns the index when served from a hidden folder', function (done) { | ||
@@ -297,3 +297,3 @@ var server = provisionServer({ files: { relativeTo: __dirname } }); | ||
it('returns listing when found in hidden folder', function (done) { | ||
it('returns listing when served from a hidden folder', function (done) { | ||
@@ -378,2 +378,31 @@ var server = provisionServer({ files: { relativeTo: __dirname } }); | ||
it('returns a 404 response when requesting a file in a hidden directory when showHidden is disabled', function (done) { | ||
var server = provisionServer({ files: { relativeTo: __dirname } }); | ||
server.route({ method: 'GET', path: '/noshowhidden/{path*}', handler: { directoryTest: { path: './directory', listing: true } } }); | ||
server.inject('/noshowhidden/.dot/index.html', function (res) { | ||
expect(res.statusCode).to.equal(404); | ||
server.inject('/noshowhidden/.dot/', function (res) { | ||
expect(res.statusCode).to.equal(404); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
it('returns a 404 response when requesting a hidden directory listing when showHidden is disabled', function (done) { | ||
var server = provisionServer({ files: { relativeTo: __dirname } }); | ||
server.route({ method: 'GET', path: '/noshowhidden/{path*}', handler: { directoryTest: { path: './directory', listing: true, index: false } } }); | ||
server.inject('/noshowhidden/.dot/', function (res) { | ||
expect(res.statusCode).to.equal(404); | ||
done(); | ||
}); | ||
}); | ||
it('returns a file when requesting a hidden file when showHidden is enabled', function (done) { | ||
@@ -391,2 +420,21 @@ | ||
it('returns a a file when requesting a file in a hidden directory when showHidden is enabled', function (done) { | ||
var server = provisionServer({ files: { relativeTo: __dirname } }); | ||
server.route({ method: 'GET', path: '/noshowhidden/{path*}', handler: { directoryTest: { path: './directory', showHidden: true, listing: true } } }); | ||
server.inject('/noshowhidden/.dot/index.html', function (res) { | ||
expect(res.statusCode).to.equal(200); | ||
expect(res.payload).to.contain('test'); | ||
server.inject('/noshowhidden/.dot/', function (res) { | ||
expect(res.statusCode).to.equal(200); | ||
expect(res.payload).to.contain('test'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
it('redirects to the same path with / appended if asking for a directory', function (done) { | ||
@@ -393,0 +441,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
340517
1362
3