identifiers-validation: Allow +
in the localpart of user IDs
According to MSC4009
This commit is contained in:
parent
a9a6e67ed0
commit
8bdfd809e4
@ -1,9 +1,15 @@
|
||||
# [unreleased]
|
||||
|
||||
Bug fixes:
|
||||
|
||||
- Don't consider empty localpart of a user ID as valid
|
||||
- It is accepted under the `compat-user-id` feature, but not considered
|
||||
fully-conforming
|
||||
|
||||
Improvements:
|
||||
|
||||
- Allow `+` in the localpart of user IDs according to MSC4009
|
||||
|
||||
# 0.9.1
|
||||
|
||||
Improvements:
|
||||
|
@ -20,9 +20,9 @@ pub fn validate(s: &str) -> Result<(), Error> {
|
||||
pub fn localpart_is_fully_conforming(localpart: &str) -> Result<bool, Error> {
|
||||
// See https://spec.matrix.org/latest/appendices/#user-identifiers
|
||||
let is_fully_conforming = !localpart.is_empty()
|
||||
&& localpart
|
||||
.bytes()
|
||||
.all(|b| matches!(b, b'0'..=b'9' | b'a'..=b'z' | b'-' | b'.' | b'=' | b'_' | b'/'));
|
||||
&& localpart.bytes().all(
|
||||
|b| matches!(b, b'0'..=b'9' | b'a'..=b'z' | b'-' | b'.' | b'=' | b'_' | b'/' | b'+'),
|
||||
);
|
||||
|
||||
if !is_fully_conforming {
|
||||
// If it's not fully conforming, check if it contains characters that are also disallowed
|
||||
|
Loading…
x
Reference in New Issue
Block a user