thadillo Claude commited on
Commit
26d9af5
·
1 Parent(s): ebb7d3d

Fix category update error when setting to uncategorized

Browse files

When admin selects "Not categorized" option, frontend sends empty
string which was being validated against CATEGORIES list and failing.

Fix: Convert empty string or 'null' to None before validation,
allowing submissions to be uncategorized.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app/routes/admin.py +5 -1
app/routes/admin.py CHANGED
@@ -226,7 +226,11 @@ def update_category(submission_id):
226
  data = request.json
227
  category = data.get('category')
228
 
229
- # Validate category
 
 
 
 
230
  if category and category not in CATEGORIES:
231
  return jsonify({'success': False, 'error': 'Invalid category'}), 400
232
 
 
226
  data = request.json
227
  category = data.get('category')
228
 
229
+ # Convert empty string to None
230
+ if category == '' or category == 'null':
231
+ category = None
232
+
233
+ # Validate category if not None
234
  if category and category not in CATEGORIES:
235
  return jsonify({'success': False, 'error': 'Invalid category'}), 400
236