From 9d640b57cee557541b5b46db46a8cde234fbe10a Mon Sep 17 00:00:00 2001 From: Jan-Peter Klein Date: Wed, 13 Sep 2023 12:31:53 +0200 Subject: [PATCH] added build number to user-agent header --- src/main/java/org/cryptomator/ui/error/ErrorController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/error/ErrorController.java b/src/main/java/org/cryptomator/ui/error/ErrorController.java index 8fcc01ea8..5009229b5 100644 --- a/src/main/java/org/cryptomator/ui/error/ErrorController.java +++ b/src/main/java/org/cryptomator/ui/error/ErrorController.java @@ -42,7 +42,7 @@ public class ErrorController implements FxController { private static final ObjectMapper JSON = new ObjectMapper(); private static final Logger LOG = LoggerFactory.getLogger(ErrorController.class); - private static final String USER_AGENT_VERSION_FORMAT = "Cryptomator/%s"; + private static final String USER_AGENT_VERSION_FORMAT = "Cryptomator/%s (Build %s)"; private static final String ERROR_CODES_URL_FORMAT = "https://api.cryptomator.org/desktop/error-codes.json?error-code=%s"; private static final String SEARCH_URL_FORMAT = "https://github.com/cryptomator/cryptomator/discussions/categories/errors?discussions_q=category:Errors+%s"; private static final String REPORT_URL_FORMAT = "https://github.com/cryptomator/cryptomator/discussions/new?category=Errors&title=Error+%s&body=%s"; @@ -147,7 +147,7 @@ public class ErrorController implements FxController { askedForLookupDatabasePermission.set(true); HttpClient httpClient = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).build(); HttpRequest httpRequest = HttpRequest.newBuilder()// - .header("User-Agent", USER_AGENT_VERSION_FORMAT.formatted(environment.getAppVersion())) + .header("User-Agent", USER_AGENT_VERSION_FORMAT.formatted(environment.getAppVersion(),environment.getBuildNumber().orElse("undefined"))) .uri(URI.create(ERROR_CODES_URL_FORMAT.formatted(URLEncoder.encode(errorCode.toString(),StandardCharsets.UTF_8))))// .build(); httpClient.sendAsync(httpRequest, HttpResponse.BodyHandlers.ofInputStream())//