From 633f1e2380e1925b48cdbffdd804494e20ddd13f Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 20 May 2026 15:48:06 -0400 Subject: [PATCH] fix: reseed script now skips -sm and -md variant files Previously all .webp files were indexed including thumbnails and medium variants, causing each photo to appear three times in the gallery. Co-Authored-By: Claude Sonnet 4.6 --- .../photo-gallery-app/backend/scripts/reseed_uploads.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main-site/photo-gallery-app/backend/scripts/reseed_uploads.js b/main-site/photo-gallery-app/backend/scripts/reseed_uploads.js index 02d1605..90a691f 100644 --- a/main-site/photo-gallery-app/backend/scripts/reseed_uploads.js +++ b/main-site/photo-gallery-app/backend/scripts/reseed_uploads.js @@ -37,7 +37,10 @@ async function main() { await mongoose.connect(MONGO_URI); console.log('Connected to Mongo:', MONGO_URI); - const files = fs.readdirSync(UPLOAD_DIR).filter(f => f.toLowerCase().endsWith('.webp')); + const files = fs.readdirSync(UPLOAD_DIR).filter(f => { + const lower = f.toLowerCase(); + return lower.endsWith('.webp') && !lower.endsWith('-sm.webp') && !lower.endsWith('-md.webp'); + }); let created = 0; for (const file of files) { const existing = await Photo.findOne({ filename: file });