Daniel Brötzmann pushed to branch master at gajim / python-nbxmpp
Commits:
495e19c8 by wurstsalat at 2025-03-01T11:44:10+01:00
other: Readme: Fix formatting, add section for tests
- - - - -
2 changed files:
- nbxmpp/xmppiri.py
- test/unit/test_jid_parsing.py
Changes:
=====================================
nbxmpp/xmppiri.py
=====================================
@@ -124,8 +124,10 @@ def clean_iri(iri_str: str) -> str:
if iri_str.startswith("//"):
# Remove auth component
+ # https://datatracker.ietf.org/doc/html/rfc5122#section-2.3
iri_str = iri_str.removeprefix("//")
- iri_str = iri_str.split("/", maxsplit=1)[1]
+ components = iri_str.split("/", maxsplit=1)
+ iri_str = components[1] if len(components) > 1 else components[0]
# Remove query and fragment
iri_str = iri_str.split("?", maxsplit=1)[0]
=====================================
test/unit/test_jid_parsing.py
=====================================
@@ -238,6 +238,7 @@ class JIDParsing(unittest.TestCase):
"xmpp:[email protected]/repulsive%20!%23%22$%25&'()*+,-.%2F:;%3C=%3E%3F%40%5B%5C%5D%5E_%60%7B%7C%7D~resource",
),
("jiři@čechy.example/v Praze",
"xmpp:jiři@čechy.example/v%20Praze"),
+ ("[email protected]", "xmpp://[email protected]"),
]
for jid_string, iri_string in tests:
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/495e19c83ab6f2cf6df2fc5be9c0ed2d753e8a70
--
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/495e19c83ab6f2cf6df2fc5be9c0ed2d753e8a70
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]