[object Object]

← back to 1800swallpaper

404-guard: extend regex to .rej .swo and tilde-suffixed paths

efda45d456fecc335d9bf70e6813e82ac0d8b6fc · 2026-05-19 18:39:19 -0700 · Steve

Files touched

Diff

commit efda45d456fecc335d9bf70e6813e82ac0d8b6fc
Author: Steve <steve@designerwallcoverings.com>
Date:   Tue May 19 18:39:19 2026 -0700

    404-guard: extend regex to .rej .swo and tilde-suffixed paths
---
 server.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/server.js b/server.js
index 1fc971d..8b67500 100644
--- a/server.js
+++ b/server.js
@@ -138,7 +138,10 @@ require('./_universal-auth')(app, { siteName: "1800swallpaper" });
 
 // 404-guard: never serve snapshot/backup files from the static root.
 app.use((req, res, next) => {
-  if (/\.(bak|pre-[^/]*|orig|tmp|swp)$/i.test(req.path) || /\.bak\./i.test(req.path) || /\.pre-/i.test(req.path)) {
+  if (/\.(bak|orig|rej|tmp|swp|swo)$/i.test(req.path)
+      || /\.bak\./i.test(req.path)
+      || /\.pre-/i.test(req.path)
+      || /~$/.test(req.path)) {
     return res.status(404).send('Not found');
   }
   next();

← 36ffded gitignore: broaden snapshot patterns and clear stale bak/pre  ·  back to 1800swallpaper  ·  make server.js self-contained — gate _shared/admin-catalog b fda530c →