mirror of https://github.com/shred/acme4j
Accept mailto if present
parent
09a72d606b
commit
01a2206c62
|
@ -105,7 +105,11 @@ public class AccountBuilder {
|
||||||
* if there is a syntax error in the URI string
|
* if there is a syntax error in the URI string
|
||||||
*/
|
*/
|
||||||
public AccountBuilder addEmail(String email) {
|
public AccountBuilder addEmail(String email) {
|
||||||
addContact("mailto:" + email);
|
if (email.startsWith("mailto:")) {
|
||||||
|
addContact(email);
|
||||||
|
} else {
|
||||||
|
addContact("mailto:" + email);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,5 +204,9 @@ public class AccountBuilderTest {
|
||||||
var builder = Mockito.spy(AccountBuilder.class);
|
var builder = Mockito.spy(AccountBuilder.class);
|
||||||
builder.addEmail("foo@example.com");
|
builder.addEmail("foo@example.com");
|
||||||
Mockito.verify(builder).addContact(Mockito.eq("mailto: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"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue