From e1a3b48c6e39df892655571a0b69cb415612790c Mon Sep 17 00:00:00 2001 From: Ravi Khadiwala Date: Fri, 14 Feb 2025 14:32:39 -0600 Subject: [PATCH] Only set X-Signal-Agent if present --- .../textsecuregcm/controllers/AccountController.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java index ffe7dad20..1127cdbe4 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java @@ -34,6 +34,7 @@ import java.util.Optional; import java.util.UUID; import java.util.concurrent.CompletableFuture; import javax.annotation.Nullable; +import org.apache.commons.lang3.StringUtils; import org.signal.libsignal.usernames.BaseUsernameException; import org.whispersystems.textsecuregcm.auth.AuthenticatedDevice; import org.whispersystems.textsecuregcm.auth.SaltedTokenHash; @@ -232,7 +233,9 @@ public class AccountController { d.setName(attributes.getName()); d.setLastSeen(Util.todayInMillis()); d.setCapabilities(attributes.getCapabilities()); - d.setUserAgent(userAgent); + if (StringUtils.isNotBlank(userAgent)) { + d.setUserAgent(userAgent); + } }); a.setRegistrationLockFromAttributes(attributes);