mirror of
https://github.com/shred/acme4j.git
synced 2025-12-16 11:24:01 +08:00
Accept mailto if present
This commit is contained in:
@@ -105,7 +105,11 @@ public class AccountBuilder {
|
||||
* if there is a syntax error in the URI string
|
||||
*/
|
||||
public AccountBuilder addEmail(String email) {
|
||||
addContact("mailto:" + email);
|
||||
if (email.startsWith("mailto:")) {
|
||||
addContact(email);
|
||||
} else {
|
||||
addContact("mailto:" + email);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -204,5 +204,9 @@ public class AccountBuilderTest {
|
||||
var builder = Mockito.spy(AccountBuilder.class);
|
||||
builder.addEmail("foo@example.com");
|
||||
Mockito.verify(builder).addContact(Mockito.eq("mailto:foo@example.com"));
|
||||
|
||||
// mailto is still accepted if present
|
||||
builder.addEmail("mailto:bar@example.com");
|
||||
Mockito.verify(builder).addContact(Mockito.eq("mailto:bar@example.com"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user