Commit 72efe88
fix: Fix BeforeValidator treating 0 as falsy in configuration fields (#819)
## Summary
- The `BeforeValidator(lambda val: val or None)` on
`max_paid_dataset_items` and `max_total_charge_usd` configuration fields
treated `0` as falsy, converting it to `None`. This meant a legitimate
value of `0` (e.g. a zero charge limit) would be silently discarded.
- Replaced with `lambda val: val if val != '' else None` which only
converts empty strings (from unset env vars) to `None`, preserving `0`
as a valid value.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent f980b0a commit 72efe88
File tree
2 files changed
+31
-2
lines changed- src/apify
- tests/unit/actor
2 files changed
+31
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
| 298 | + | |
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | | - | |
| 307 | + | |
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
278 | 307 | | |
279 | 308 | | |
280 | 309 | | |
| |||
0 commit comments