Tighten email address constraint for tagging With the preferred email address of ChatGPT users now available to be used for directing queries to ChatGPT, a strict matching constraint for these email addresses is implemented. Specifically, the format "@<ChatGPT_username>@<any_domain>" will no longer trigger the ChatGPT's replies. This replaces the previous regular expression that matched any email starting with the username (typically "gpt") assuming it was the usual format for ChatGPT email addresses. Change-Id: I6228c83f4773d607cb936fa51ca1d0d4d6def66e Signed-off-by: Patrizio <patrizio.gelosi@amarulasolutions.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/common/ClientMessage.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/common/ClientMessage.java index 82cb931..1841e12 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/common/ClientMessage.java +++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/client/common/ClientMessage.java
@@ -77,7 +77,7 @@ } private Pattern getBotMentionPattern() { - String emailRegex = "@" + getUserNameOrEmail() + "(?:@[A-Za-z0-9.-]+\\.[A-Za-z]{2,})?\\b"; + String emailRegex = "@" + getUserNameOrEmail() + "\\b"; return Pattern.compile(emailRegex); }