From 8dd990566527195c0e8c4a122d69f6f7744a689b Mon Sep 17 00:00:00 2001 From: cintolas Date: Fri, 5 Mar 2021 03:42:25 -0800 Subject: [PATCH 1/9] Remove files that fail to stat remove files that fail to stat instead of completely breaking --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 09086acc..d6edf41b 100644 --- a/index.js +++ b/index.js @@ -247,7 +247,7 @@ serveIndex.plain = function _plain (req, res, files, next, dir, showUp, icons, p fileList.sort(fileSort) // serialize - var body = fileList.map(function (file) { + var body = fileList.filter(function(c) { return c }).map(function (file) { return file.name }).join('\n') + '\n' @@ -564,7 +564,8 @@ function stat(dir, files, cb) { files.forEach(function(file){ batch.push(function(done){ fs.stat(join(dir, file), function(err, stat){ - if (err && err.code !== 'ENOENT') return done(err); + //hide files that fail to stat + if (err && err.code !== 'ENOENT') return done(); // pass ENOENT as null stat, not error done(null, { From d770640e6eb587d24ec99076d0a01788d61dec19 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 10 Aug 2021 16:22:00 -0700 Subject: [PATCH 2/9] rename package --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 41269ee4..0c219166 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "serve-index", + "name": "fastx-serve-index", "description": "Serve directory listings", - "version": "1.9.1", + "version": "1.9.2", "author": "Douglas Christopher Wilson ", "license": "MIT", "repository": "expressjs/serve-index", From 14f0c4c8fc91d43ba3513d92d71c6c5df38f1d44 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 11 Aug 2021 03:16:20 -0700 Subject: [PATCH 3/9] change directory name --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0c219166..62e14ee4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fastx-serve-index", "description": "Serve directory listings", - "version": "1.9.2", + "version": "1.9.3", "author": "Douglas Christopher Wilson ", "license": "MIT", "repository": "expressjs/serve-index", From 52dc336cb2e57f1d05b48581f7388a0f00880dba Mon Sep 17 00:00:00 2001 From: cintolas Date: Wed, 8 Jun 2022 04:36:30 -0700 Subject: [PATCH 4/9] add a base local --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index ec7dc111..13dbf6c7 100644 --- a/index.js +++ b/index.js @@ -201,7 +201,8 @@ serveIndex.html = function _html(req, res, files, next, dir, showUp, icons, path fileList: fileList, path: path, style: style, - viewName: view + viewName: view, + base: req.base || '', }; // render html @@ -330,7 +331,8 @@ function createHtmlRender(template) { .replace(/\{style\}/g, locals.style.concat(iconStyle(locals.fileList, locals.displayIcons))) .replace(/\{files\}/g, createHtmlFileList(locals.fileList, locals.directory, locals.displayIcons, locals.viewName)) .replace(/\{directory\}/g, escapeHtml(locals.directory)) - .replace(/\{linked-path\}/g, htmlPath(locals.directory)); + .replace(/\{linked-path\}/g, htmlPath(locals.directory)) + .replace(/\{base\}/g, htmlPath(locals.base); callback(null, body); }); From a7cdf063674d631ef4896917f6ae4585026b44c8 Mon Sep 17 00:00:00 2001 From: cintolas Date: Wed, 8 Jun 2022 04:39:36 -0700 Subject: [PATCH 5/9] update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 62e14ee4..c9fccb8d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fastx-serve-index", "description": "Serve directory listings", - "version": "1.9.3", + "version": "1.9.4", "author": "Douglas Christopher Wilson ", "license": "MIT", "repository": "expressjs/serve-index", From b880f2de5e1ad898313b374a2da52aeeec31c746 Mon Sep 17 00:00:00 2001 From: cintolas Date: Wed, 8 Jun 2022 04:44:50 -0700 Subject: [PATCH 6/9] fix error --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 13dbf6c7..8c6618b1 100644 --- a/index.js +++ b/index.js @@ -332,7 +332,7 @@ function createHtmlRender(template) { .replace(/\{files\}/g, createHtmlFileList(locals.fileList, locals.directory, locals.displayIcons, locals.viewName)) .replace(/\{directory\}/g, escapeHtml(locals.directory)) .replace(/\{linked-path\}/g, htmlPath(locals.directory)) - .replace(/\{base\}/g, htmlPath(locals.base); + .replace(/\{base\}/g, htmlPath(locals.base)); callback(null, body); }); From bb5035ee850d1bdd9dc6053af46f8f5d5c92f43a Mon Sep 17 00:00:00 2001 From: cintolas Date: Wed, 8 Jun 2022 04:45:14 -0700 Subject: [PATCH 7/9] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c9fccb8d..26f439b3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fastx-serve-index", "description": "Serve directory listings", - "version": "1.9.4", + "version": "1.9.5", "author": "Douglas Christopher Wilson ", "license": "MIT", "repository": "expressjs/serve-index", From 155f7301596c1eb9dc3d72b6cc73526e3127b59c Mon Sep 17 00:00:00 2001 From: cintolas Date: Wed, 8 Jun 2022 04:49:36 -0700 Subject: [PATCH 8/9] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 8c6618b1..e0a625f6 100644 --- a/index.js +++ b/index.js @@ -332,7 +332,7 @@ function createHtmlRender(template) { .replace(/\{files\}/g, createHtmlFileList(locals.fileList, locals.directory, locals.displayIcons, locals.viewName)) .replace(/\{directory\}/g, escapeHtml(locals.directory)) .replace(/\{linked-path\}/g, htmlPath(locals.directory)) - .replace(/\{base\}/g, htmlPath(locals.base)); + .replace(/\{base\}/g, locals.base); callback(null, body); }); From 62327b139f8e6880b0f8a799f896070f5fc594c8 Mon Sep 17 00:00:00 2001 From: cintolas Date: Wed, 8 Jun 2022 04:49:56 -0700 Subject: [PATCH 9/9] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 26f439b3..68df77ec 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fastx-serve-index", "description": "Serve directory listings", - "version": "1.9.5", + "version": "1.9.6", "author": "Douglas Christopher Wilson ", "license": "MIT", "repository": "expressjs/serve-index",