fix: MediaWiki import - increase limit to 500 and add validation
Error: 422 Unprocessable Entity when limit > 100 Root cause: Backend enforced max=100, frontend allowed any value Backend fix: - Increased preview limit from 100 to 500 (consistent with execute) - import_wiki.py line 64: le=100 → le=500 Frontend fix: - Added Math.min/max validation to both limit inputs - Preview limit: max 500 with auto-clamp - Execute limit: max 500 with auto-clamp - Updated placeholder: 'Kein Limit (max 500)' Prevents 422 errors from invalid limit values
This commit is contained in:
parent
89055ddbc4
commit
c738f1234b
|
|
@ -61,7 +61,7 @@ def require_admin(session: dict = Depends(require_auth)) -> dict:
|
|||
async def preview_import(
|
||||
category: str = Query(default=CATEGORY_EXERCISES),
|
||||
import_type: str = Query(default="exercise"),
|
||||
limit: int = Query(default=10, ge=1, le=100),
|
||||
limit: int = Query(default=10, ge=1, le=500),
|
||||
session: dict = Depends(require_admin),
|
||||
):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -202,9 +202,9 @@ export default function MediaWikiImportPage() {
|
|||
<input
|
||||
type="number"
|
||||
value={previewLimit}
|
||||
onChange={(e) => setPreviewLimit(parseInt(e.target.value) || 10)}
|
||||
onChange={(e) => setPreviewLimit(Math.min(500, Math.max(1, parseInt(e.target.value) || 10)))}
|
||||
min="1"
|
||||
max="100"
|
||||
max="500"
|
||||
style={{
|
||||
width: '100%',
|
||||
padding: '12px',
|
||||
|
|
@ -368,9 +368,13 @@ export default function MediaWikiImportPage() {
|
|||
<input
|
||||
type="number"
|
||||
value={executeLimit || ''}
|
||||
onChange={(e) => setExecuteLimit(e.target.value ? parseInt(e.target.value) : null)}
|
||||
placeholder="Kein Limit"
|
||||
onChange={(e) => {
|
||||
const val = e.target.value ? parseInt(e.target.value) : null
|
||||
setExecuteLimit(val ? Math.min(500, Math.max(1, val)) : null)
|
||||
}}
|
||||
placeholder="Kein Limit (max 500)"
|
||||
min="1"
|
||||
max="500"
|
||||
style={{
|
||||
width: '100%',
|
||||
padding: '12px',
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user