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 <noreply@anthropic.com>
This commit is contained in:
chris 2026-05-20 15:48:06 -04:00
parent 2723a6d954
commit 633f1e2380

View File

@ -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 });