[object Object]

← back to Textilewallpaper

404-guard stale .bak/.pre snapshot files from static root

09eb725a6d82de11494fd62006f31619edb8743f · 2026-05-18 20:55:24 -0700 · Steve Abrams

Files touched

Diff

commit 09eb725a6d82de11494fd62006f31619edb8743f
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon May 18 20:55:24 2026 -0700

    404-guard stale .bak/.pre snapshot files from static root
---
 server.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/server.js b/server.js
index 161f484..f22293f 100644
--- a/server.js
+++ b/server.js
@@ -134,6 +134,11 @@ app.use(express.json({ limit: "256kb" }));
 const cfg = require('../_shared/site-config').load(__dirname);
 require("./_universal-contact")(app, cfg.contact);
 require("./_universal-auth")(app, cfg.auth);
+// Block stale snapshot files in public/ from being served as static content.
+app.use((req, res, next) => {
+  if (/\.(bak|pre-[^/]*)($|\.)|\.bak\.|\.pre-/i.test(req.path)) return res.status(404).send('Not found');
+  next();
+});
 app.use(express.static(path.join(__dirname, 'public')));
 
 app.get('/api/products', (req, res) => {

← b38314c untrack 18 .bak/.pre snapshot files and broaden .gitignore p  ·  back to Textilewallpaper  ·  stage2: wire microsite catalog + admin CRUD + grid/list view f9c6c31 →