← back to Chinoiseriewallpaper
block .bak/.pre-* snapshot files from being served as static assets
8b1e9bd9d7dfff281e31d50af39691a122e399fd · 2026-05-18 20:49:30 -0700 · Steve Abrams
Files touched
Diff
commit 8b1e9bd9d7dfff281e31d50af39691a122e399fd
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon May 18 20:49:30 2026 -0700
block .bak/.pre-* snapshot files from being served as static assets
---
server.js | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/server.js b/server.js
index 00db005..e1a63fd 100644
--- a/server.js
+++ b/server.js
@@ -191,6 +191,15 @@ function decorateColors(items) {
// ── Express ────────────────────────────────────────────────────────────────
const app = express();
app.use(express.json({ limit: '256kb' }));
+
+// Block snapshot/backup files (*.bak, *.pre-*) from being served as static assets.
+app.use((req, res, next) => {
+ if (/\.(bak|pre-[^/]*)$|\.bak\.|\.pre-/i.test(req.path)) {
+ return res.status(404).type('text/plain').send('Not found');
+ }
+ next();
+});
+
app.use(express.static(path.join(__dirname, 'public')));
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
← 31c7dd2 untrack stale snapshot files; gitignore .bak/.pre-* patterns
·
back to Chinoiseriewallpaper
·
stage2: wire microsite catalog + admin CRUD + /api/sliders 2fb17f4 →