Comparing version 3.0.0 to 3.0.1
{ | ||
"name": "st", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "A module for serving static files. Does etags, caching, etc.", | ||
@@ -5,0 +5,0 @@ "main": "st.js", |
@@ -226,3 +226,6 @@ const mime = require('mime') | ||
getPath (u) { | ||
return path.join(this.path, u) | ||
// trailing slash removal to fix Node.js v23 bug | ||
// https://github.com/nodejs/node/pull/55527 | ||
// can be removed when this is resolved and released | ||
return path.join(this.path, u.replace(/\/+$/, '')) | ||
} | ||
@@ -229,0 +232,0 @@ |
@@ -100,2 +100,10 @@ const zlib = require('zlib') | ||
test('trailing slash', (t) => { | ||
req('/test/test/fixtures/', (er, res, body) => { | ||
t.equal(res.statusCode, 200) | ||
t.ok(/<html>.*Index of \/test\/fixtures<[\s\S]+index\.html[\s\S]+space in filename\.txt[\s\S]+<\/html>/.test(body.toString())) | ||
t.end() | ||
}) | ||
}) | ||
test('space in filename', (t) => { | ||
@@ -102,0 +110,0 @@ req('/test/test/fixtures/space in filename.txt', (er, res, body) => { |
const os = require('os') | ||
const dns = require('dns') | ||
let { test, fail, comment } = require('tap') | ||
@@ -77,8 +78,2 @@ const { serve } = require('./common') | ||
testServer( | ||
'Restricted to localhost', | ||
['--localhost'], 'localhost', | ||
['127.0.0.1', 'localhost'], [otherAddress] | ||
) | ||
testServer( | ||
'Restricted to non-local host', | ||
@@ -94,1 +89,12 @@ ['--host', otherAddress], otherAddress, | ||
) | ||
dns.lookup('localhost', (err, address) => { | ||
if (err) { | ||
throw err | ||
} | ||
testServer( | ||
'Restricted to localhost', | ||
['--localhost'], 'localhost', | ||
[address, 'localhost'], [otherAddress] | ||
) | ||
}) |
@@ -93,3 +93,3 @@ const st = require('../st.js') | ||
}) | ||
middlewareServer.listen(port, '127.0.0.1', function () { | ||
middlewareServer.listen(port, 'localhost', function () { | ||
t.pass('listening') | ||
@@ -107,3 +107,3 @@ t.end() | ||
}) | ||
server.listen(port + 1, '127.0.0.1', function () { | ||
server.listen(port + 1, 'localhost', function () { | ||
t.pass('listening') | ||
@@ -119,2 +119,3 @@ t.end() | ||
req('/test/st.js', function (er, res, body) { | ||
t.error(er) | ||
t.equal(res.statusCode, 200) | ||
@@ -121,0 +122,0 @@ t.ok(res.headers.etag) |
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
Network access
Supply chain riskThis module accesses the network.
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
67706
38
1780
8