mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-20 16:26:22 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user