← back to Analytics Chips
gitignore: cover *.bak/*.pre-* snapshots; add Express 404-guard so they never serve from public/
31c1781c895d69a219f7988533cb9d7c428a3e96 · 2026-05-19 17:26:17 -0700 · SteveStudio2
Adds a clean-URL /categories alias mirroring /categories.html.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit 31c1781c895d69a219f7988533cb9d7c428a3e96
Author: SteveStudio2 <steve@designerwallcoverings.com>
Date: Tue May 19 17:26:17 2026 -0700
gitignore: cover *.bak/*.pre-* snapshots; add Express 404-guard so they never serve from public/
Adds a clean-URL /categories alias mirroring /categories.html.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
.gitignore | 4 ++++
server.js | 13 +++++++++++++
2 files changed, 17 insertions(+)
diff --git a/.gitignore b/.gitignore
index 1924158..9a09e17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,7 @@ tmp/
dist/
build/
.next/
+*.bak
+*.bak.*
+*.pre-*
+.pre-*
diff --git a/server.js b/server.js
index 7b6df57..c6a9a78 100644
--- a/server.js
+++ b/server.js
@@ -69,8 +69,21 @@ async function getMetrics() {
}
const app = express();
+
+// Refuse to serve snapshot/backup files even if a stray *.bak / .pre-* lands
+// in public/. Runs BEFORE express.static so it short-circuits any match.
+app.use((req, res, next) => {
+ if (/(?:^|\/)(?:\.pre-|[^/]+\.(?:bak)(?:\..+)?$|[^/]+\.pre-)/i.test(req.path)) {
+ return res.status(404).type('text').send('not found');
+ }
+ next();
+});
+
app.use(express.static(path.join(__dirname, 'public')));
+// Clean-URL alias for the categories page (matches the nav link style).
+app.get('/categories', (_req, res) => res.sendFile(path.join(__dirname, 'public', 'categories.html')));
+
app.get('/api/properties', (_req, res) => {
// Combine domain → G-ID + brand draft into a single payload
const list = Object.entries(PROPS).map(([domain, gid]) => ({
← 4a62fd8 snapshot: 3 file(s) changed, +2 new, ~1 modified
·
back to Analytics Chips
·
categories: harden external chip links with rel="noopener no 331b54b →