Skip to content

QualifiedSWHID: Fix (de)serialization of 'origin' qualifier

vlorentz requested to merge qualified-swhid-origin into master

Having the escaped URL in swhid.origin is inconsistent with self.path (which is always escaped) and never what we want, because it is only useful while serializing, which is already handled by __str__.

This led to swh-indexer#4738 (closed) where swh-deposit parsed a qualified SWHID, then used .origin to get an origin URL.

Additionally, as serialization always escapes the origin qualifier, this means that deserializing then re-serializing a qualified SWHID would double-escape it.

Finally, fixing this made the test uncover that % was not escaped while serializing, while ; was, leading to incorrect (and ambiguous) escaped URLs.

Merge request reports