feat: handle and allow JIDs with trailing slashes

Make jid_is_valid() allow JIDs ending with a slash (`user@domain/`).
In these cases, the parser now treats the input as a Bare JID with no
resource part, rather than rejecting it as invalid.

We will then just get `user@domain`.
This commit is contained in:
Michael Vetter
2026-03-06 13:17:13 +01:00
parent 35a2f2990a
commit f251cc8bb3
4 changed files with 14 additions and 6 deletions

View File

@@ -157,11 +157,11 @@ jid_is_valid(const gchar* const str)
domain_start = at + 1;
}
// Resourcepart validation
// Resourcepart validation if present
if (slash) {
domain_len = slash - domain_start;
size_t resource_len = strlen(slash + 1);
if (resource_len == 0 || resource_len > JID_MAX_PART_LEN) {
if (resource_len > JID_MAX_PART_LEN) {
return FALSE;
}
} else {