← back to Commercialdesignreps
gitignore + server: ignore *.bak/*.pre-* snapshots and 404 them at static root
90c5f097af0b3ce0398ee9ee2cbd8b1fc18bed3e · 2026-05-19 17:34:19 -0700 · Steve Abrams
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit 90c5f097af0b3ce0398ee9ee2cbd8b1fc18bed3e
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue May 19 17:34:19 2026 -0700
gitignore + server: ignore *.bak/*.pre-* snapshots and 404 them at static root
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
.gitignore | 3 +++
server.js | 8 ++++++++
2 files changed, 11 insertions(+)
diff --git a/.gitignore b/.gitignore
index 4a0b3ea..a90a60e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,6 @@ tmp/
dist/
build/
.next/
+*.bak
+*.bak.*
+*.pre-*
diff --git a/server.js b/server.js
index 0a5a534..8ce40be 100644
--- a/server.js
+++ b/server.js
@@ -26,6 +26,14 @@ app.use((req, res, next) => {
next();
});
+// Hard 404 guard: never serve snapshot/backup files even if they end up in public/
+app.use((req, res, next) => {
+ if (/\.(bak)(\.|$)|\.pre-/i.test(req.path)) {
+ return res.status(404).render('404', { site: SITE });
+ }
+ next();
+});
+
app.use(express.static(path.join(__dirname, 'public'), { maxAge: '1h' }));
const allTerritories = Array.from(new Set(reps.flatMap(r => r.territories))).sort();
← b031a6d rep page: add noreferrer to external Contact agency link
·
back to Commercialdesignreps
·
Add per-site favicon (kills /favicon.ico 404) f4ddc59 →