From 81008270f208508cfd1571c405a2b4a162b92508 Mon Sep 17 00:00:00 2001 From: uzlopak Date: Sat, 14 Jan 2023 15:43:36 +0100 Subject: [PATCH] remove backwards compatibilty of dotfiles --- index.js | 17 ++--------------- test/send.test.js | 10 +--------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/index.js b/index.js index aa23256..6910907 100644 --- a/index.js +++ b/index.js @@ -122,11 +122,6 @@ function SendStream (req, path, options) { throw new TypeError('dotfiles option must be "allow", "deny", or "ignore"') } - // legacy support - if (opts.dotfiles === undefined) { - this._dotfiles = undefined - } - this._extensions = opts.extensions !== undefined ? normalizeList(opts.extensions, 'extensions option') : [] @@ -483,16 +478,8 @@ SendStream.prototype.pipe = function pipe (res) { // dotfile handling if (containsDotFile(parts)) { - let access = this._dotfiles - - if (access === undefined) { - access = parts[parts.length - 1][0] === '.' - ? 'ignore' - : 'allow' - } - - debug('%s dotfile "%s"', access, path) - switch (access) { + debug('%s dotfile "%s"', this._dotfiles, path) + switch (this._dotfiles) { case 'allow': break case 'deny': diff --git a/test/send.test.js b/test/send.test.js index 395d12e..dc2bf54 100644 --- a/test/send.test.js +++ b/test/send.test.js @@ -163,7 +163,7 @@ test('send(file, options)', function (t) { }) t.test('dotfiles', function (t) { - t.plan(6) + t.plan(5) t.test('should default to "ignore"', function (t) { t.plan(1) @@ -173,14 +173,6 @@ test('send(file, options)', function (t) { .expect(404, err => t.error(err)) }) - t.test('should allow file within dotfile directory for back-compat', function (t) { - t.plan(1) - - request(createServer({ root: fixtures })) - .get('/.mine/name.txt') - .expect(200, /tobi/, err => t.error(err)) - }) - t.test('should reject bad value', function (t) { t.plan(1)