Skip to content

URLs are not serialized according to WHATWG spec and compare differently #1167

Open
@mzmm1000

Description

@mzmm1000

Please confirm the following

  • I understand this is open source software provided for free and that I might not receive a timely response.
  • 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 instead, if
    any hesitation exists.)
  • 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, the URLs web+demo:/.//not-a-host/ and web+demo:/path/..//not-a-host/ should be considered equal after URL serialization. When parsing those URLs using ada, they are indeed serialized identically.

To Reproduce

Using yarl 1.12.1, run

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, i.e. the serialized result should be web+demo:/.//not-a-host/ in both cases.

Logs/tracebacks

n/a

Python Version

Python 3.12.6

multidict Version

Name: multidict
Version: 6.1.0

yarl Version

Name: yarl
Version: 1.12.1

OS

Linux

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions