[object Object]

← back to Wallpaperdefinitions

harden .gitignore for snapshot files + add static .bak/.pre- 404-guard

c61ba805c164e1da0f5b37c9b3615dc2ca9858d6 · 2026-05-19 08:10:57 -0700 · SteveStudio2

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit c61ba805c164e1da0f5b37c9b3615dc2ca9858d6
Author: SteveStudio2 <steve@designerwallcoverings.com>
Date:   Tue May 19 08:10:57 2026 -0700

    harden .gitignore for snapshot files + add static .bak/.pre- 404-guard
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
 .gitignore | 4 ++++
 server.js  | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/.gitignore b/.gitignore
index 08240ae..dc0e202 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,7 @@ tmp/
 .DS_Store
 dist/
 build/
+*.bak
+*.bak.*
+*.pre-*
+*.orig
diff --git a/server.js b/server.js
index 8de717d..5547604 100644
--- a/server.js
+++ b/server.js
@@ -3,6 +3,12 @@ const path = require('path');
 const app = express();
 const PORT = process.env.PORT || 9901;
 
+// 404-guard: never serve snapshot/backup files from static root
+app.use((req, res, next) => {
+  if (/\.(bak|orig)(\..*)?$|\.pre-/i.test(req.path)) return res.status(404).end();
+  next();
+});
+
 app.use(express.static(path.join(__dirname, 'public')));
 
 app.get('/health', (req, res) => res.json({ status: 'ok', site: 'wallpaperdefinitions.com' }));

← 857c715 add rel=noopener noreferrer to external target=_blank links  ·  back to Wallpaperdefinitions  ·  add corner-nav.js — universal top-right nav per _shared/corn 241cf1f →