aiondemand / aiondemand/aiondemand
Bug: get_content skips distribution_idx=0 due to falsy check in url_to_get_content
- Lenguaje dominante
- Python
- Estrellas
- 38
- Forks
- 89
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
**Describe the bug**
In `src/aiod/calls/urls.py` line 61, the URL for `get_content` is built with:
url += f"/{distribution_idx}" if distribution_idx else ""
Since `distribution_idx=0` is the default value and `0` is falsy in Python,
the condition evaluates to `False` and `/0` is never appended to the URL.
This means `get_content(..., distribution_idx=0)` silently produces an
incorrect URL, making the first distribution unreachable by default.
**To Reproduce**
```python
from aiod.calls.urls import url_to_get_content
url = url_to_get_content("datasets", "abc123", distribution_idx=0)
print(url) # prints: .../datasets/abc123/content ← missing /0
```
**Expected behavior**
`.../datasets/abc123/content/0`
**Actual behavior**
`.../datasets/abc123/content`
**Proposed Fix**
Change line 61 in `src/aiod/calls/urls.py` from:
```python
url += f"/{distribution_idx}" if distribution_idx else ""
```
to:
```python
url += f"/{distribution_idx}" if distribution_idx is not None else ""
```
**Environment**
- aiondemand version: 0.2.5
- Python version: 3.x
I am solving this bug.
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.