aio-libs / aio-libs/yarl

URLs are not serialized according to WHATWG spec and compare differently

Offen
#1,167 7 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Python
Sterne
1.5k
Forks
215
Ø Merge
1 T. 2 Min.
Gemergte PRs (30 T.)
13

Beschreibung

### Please confirm the following

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

[CoC]: ../../.github/blob/master/CODE_OF_CONDUCT.md

- [X] I have checked the [current issues][issue search] for duplicates.

[issue search]: ../search?q=is%3Aissue&type=issues

- [X] I understand this is open source software provided for free and that I might not receive a timely response.
- [X] I am positive I am **NOT** reporting a (potential) security
vulnerability, to the best of my knowledge. *(These must be shared by
submitting [this report form][vulnerability report form] instead, if
any hesitation exists.)*

[vulnerability report form]: ../security/advisories/new

- [x] I am willing to submit a pull request with reporoducers as xfailing test cases or even entire fix. *(Assign this issue to me.)*

### Describe the bug

Looking at the WHATWG example for [URL equality](https://url.spec.whatwg.org/#url-equivalence), the URLs `web+demo:/.//not-a-host/` and `web+demo:/path/..//not-a-host/` should be considered equal after [URL serialization](https://url.spec.whatwg.org/#url-serializing). When parsing those URLs using [ada](https://github.com/ada-url/ada), they are indeed serialized identically.

### To Reproduce

Using yarl 1.12.1, run
```python
import yarl
assert yarl.URL("web+demo:/path/..//not-a-host/") == yarl.URL("web+demo:/.//not-a-host/")
```

### Expected behavior

Both URLs should be serialized as described in the [WHATWG specification](https://url.spec.whatwg.org/#concept-url-serializer), i.e. the serialized result should be `web+demo:/.//not-a-host/` in both cases.

### Logs/tracebacks

```python-traceback
n/a
```

### Python Version

```console
Python 3.12.6
```

### multidict Version

```console
Name: multidict
Version: 6.1.0
```

### yarl Version

```console
Name: yarl
Version: 1.12.1
```

### OS

Linux

### Additional context

_No response_

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.