Skip to content

Commit

Permalink
[bugfix] Login::new(): do not emit a svcExtension element if ext_uris…
Browse files Browse the repository at this point in the history
… is None or empty.

Fixes issue masalachai#94.
  • Loading branch information
kmkaplan committed Mar 27, 2023
1 parent 56dae20 commit e616307
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ impl<'a> Login<'a> {
new_password: Option<&'a str>,
ext_uris: Option<&'_ [&'a str]>,
) -> Self {
let ext_uris = ext_uris.map(|uris| uris.iter().map(|&u| u.into()).collect());
let svc_ext = match ext_uris {
Some(uris) if ! uris.is_empty() => Some(ServiceExtension {
ext_uris: Some(uris.iter().map(|&u| u.into()).collect())
}),
_ => None
};

Self {
username: username.into(),
Expand All @@ -52,7 +57,7 @@ impl<'a> Login<'a> {
contact::XMLNS.into(),
domain::XMLNS.into(),
],
svc_ext: Some(ServiceExtension { ext_uris }),
svc_ext
},
}
}
Expand Down

0 comments on commit e616307

Please sign in to comment.