mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-25 01:16:18 -05:00
`sleep_requests` (and other numeric inheritable video download settings)
could arrive as strings ('' or '0.75') from the frontend NumberInputForm
and DownloadRequest bodies. These were persisted into Download.settings
(JSONB) and later triggered:
if effective['sleep_requests'] > 0:
TypeError: '>' not supported between instances of 'str' and 'int'
in VideoDownloader.execute_download (and similar sites).
Root cause: DownloadSettings.__post_init__ only filtered None/[] and did
no type coercion, even though the dataclass declared Optional[float]/int.
Changes (minimal targeted fix):
- Add _coerce_optional_number helper and apply it to all numeric fields
in DownloadSettings.__post_init__ (the existing sanitization boundary).
- Centralize legacy string coercion for persisted data in the single
read chokepoint: get_effective_video_settings.
- Simplify VideoDownloaderConfig.sleep_requests getter.
- Frontend: use parseFloat for type=number inputs + null defaults for
sleep_requests (prevents '' from ever being submitted).
- Add focused regression test for string coercion path.
- Revert unrelated change to string field filtering behavior.
No NaN/Inf speculation, no duplicated try/float guards at every call site,
no behavior change for non-numeric settings.
|
||
|---|---|---|
| .. | ||
| fixtures/configs | ||
| __init__.py | ||
| common.py | ||
| test_captions.py | ||
| test_cmd.py | ||
| test_common.py | ||
| test_config_api.py | ||
| test_config_backup_import.py | ||
| test_contexts.py | ||
| test_cross_config_disaster_recovery.py | ||
| test_dates.py | ||
| test_db.py | ||
| test_downloader.py | ||
| test_downloads_config.py | ||
| test_events.py | ||
| test_extensions.py | ||
| test_flags.py | ||
| test_root_api.py | ||
| test_rss.py | ||
| test_switches.py | ||
| test_tags.py | ||
| test_upgrade.py | ||