mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-27 06:42:05 +01:00
UserID: prevent double angle brackets around email address
This commit is contained in:
parent
6386579376
commit
ab39f0e2f3
1 changed files with 2 additions and 2 deletions
|
@ -37,7 +37,7 @@ public final class UserId implements CharSequence {
|
||||||
sb.append(" (").append(comment).append(')');
|
sb.append(" (").append(comment).append(')');
|
||||||
}
|
}
|
||||||
if (email != null) {
|
if (email != null) {
|
||||||
sb.append(sb.length() != 0 ? " <" : '<').append(email).append('>');
|
sb.append(sb.length() != 0 ? ' ' : "").append(email);
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public final class UserId implements CharSequence {
|
||||||
if (email == null) {
|
if (email == null) {
|
||||||
throw new IllegalArgumentException("Email must not be null.");
|
throw new IllegalArgumentException("Email must not be null.");
|
||||||
}
|
}
|
||||||
return new UserId(name, comment, email);
|
return new UserId(name, comment, email.matches("^<.+>$") ? email : '<' + email + '>');
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserId noEmail() {
|
public UserId noEmail() {
|
||||||
|
|
Loading…
Reference in a new issue