aio-libs / aio-libs/yarl

Handling of relative path URL

Abierto
#648 7 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Python
Estrellas
1.5k
Forks
215
Merge medio
1 d 2 min
PR fusionados (30 d)
13

Descripción

### Describe the bug

According to rfc 8089 paths for file URIs are absolute. ``yarl.URL`` does not complain about them but displays a wrong repr.

### To Reproduce

1. yarl 1.7.2
2. Instantiate file URL with "relative" path (see below)

### Expected behavior

``yarl.URL('file:foo/bar')`` should raise exception or produce instance with correct repr: ``assert repr(URL('file:foo/bar')) == 'file:foo/bar'``

### Logs/tracebacks

```python-traceback
In [1]: from yarl import URL

In [2]: URL('file:foo/bar') == URL('file:///foo/bar')
Out[2]: False

In [3]: URL('file:///foo/bar')
Out[3]: URL('file:///foo/bar')

In [4]: URL('file:foo/bar')
Out[4]: URL('file:///foo/bar')

In [5]: URL('file:foo/bar').path
Out[5]: 'foo/bar'

In [6]: URL('file:///foo/bar').path
Out[6]: '/foo/bar'
```
```

### Python Version

```console
$ python --version
3.8.12
```

### multidict Version

```console
$ python -m pip show multidict
5.1.0
```

### yarl Version

```console
$ python -m pip show yarl
1.7.2
```

### OS

NixOS

### Additional context

_No response_

### Code of Conduct

- [X] I agree to follow the aio-libs Code of Conduct

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.