From 397d33a95a09e0b0986c3f6cf5965c544992a764 Mon Sep 17 00:00:00 2001 From: Paul Nothaft Date: Sun, 1 Feb 2026 21:07:44 +0100 Subject: [PATCH] fix: increase upload limit to 1GB and fix category filters (#155, #156) - Increase nginx client_max_body_size from 100MB to 1GB for video support - Fix admin photo category filtering to properly handle numeric category IDs from the photo_categories table, not just legacy 'individual'/'collage' types - Add support for 'uncategorized' filter to show photos with no category --- backend/src/routes/adminPhotos.js | 19 +++++++++++++------ frontend/nginx.conf | 8 ++++---- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/backend/src/routes/adminPhotos.js b/backend/src/routes/adminPhotos.js index fc312d68..4bbf8bab 100644 --- a/backend/src/routes/adminPhotos.js +++ b/backend/src/routes/adminPhotos.js @@ -726,13 +726,20 @@ router.get('/:eventId/photos', adminAuth, requirePermission('photos.view'), asyn .leftJoin('photo_categories', 'photos.category_id', 'photo_categories.id') .select('photos.*', 'photo_categories.name as pc_name', 'photo_categories.slug as pc_slug'); - // Filter by type (individual/collage) - category_id maps to type - if (category_id !== undefined) { - if (category_id === '' || category_id === '0') { - // For backwards compatibility, empty category means no filter - // Don't filter anything - } else if (category_id === 'individual' || category_id === 'collage') { + // Filter by category_id + if (category_id !== undefined && category_id !== '' && category_id !== '0') { + if (category_id === 'individual' || category_id === 'collage') { + // Legacy type-based filtering query = query.where({ 'photos.type': category_id }); + } else if (category_id === 'uncategorized') { + // Filter for photos with no category assigned + query = query.whereNull('photos.category_id'); + } else { + // Numeric category ID from photo_categories table + const numericCategoryId = parseInt(category_id, 10); + if (!isNaN(numericCategoryId)) { + query = query.where({ 'photos.category_id': numericCategoryId }); + } } } diff --git a/frontend/nginx.conf b/frontend/nginx.conf index 348c669d..e0bf6905 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -8,8 +8,8 @@ server { resolver 127.0.0.11 valid=10s ipv6=off; resolver_timeout 5s; - # Allow larger file uploads (up to 100MB) - client_max_body_size 100M; + # Allow larger file uploads (up to 1GB for video support) + client_max_body_size 1G; client_body_timeout 300s; # Gzip compression @@ -60,8 +60,8 @@ server { proxy_cache_bypass $http_upgrade; proxy_read_timeout 86400; - # Allow larger uploads for API endpoints - client_max_body_size 100M; + # Allow larger uploads for API endpoints (up to 1GB for video support) + client_max_body_size 1G; client_body_timeout 300s; }