diff --git a/providers/b2/src/main/java/org/jclouds/b2/filters/RequestAuthorization.java b/providers/b2/src/main/java/org/jclouds/b2/filters/RequestAuthorization.java index b403a593226..784c7233269 100644 --- a/providers/b2/src/main/java/org/jclouds/b2/filters/RequestAuthorization.java +++ b/providers/b2/src/main/java/org/jclouds/b2/filters/RequestAuthorization.java @@ -17,6 +17,7 @@ package org.jclouds.b2.filters; import java.net.URI; +import java.nio.charset.StandardCharsets; import javax.inject.Inject; import javax.inject.Singleton; @@ -50,9 +51,11 @@ public HttpRequest filter(HttpRequest request) throws HttpException { endpoint.getPath() + (endpoint.getQuery() == null ? "" : "?" + endpoint.getQuery())); + String updatedRequestBody = request.getPayload().getRawContent().toString().replaceAll("\"accountId\":.?\".*\"", "\"accountId\":\"" + auth.accountId() + "\""); request = request.toBuilder() .endpoint(endpoint) .replaceHeader(HttpHeaders.AUTHORIZATION, auth.authorizationToken()) + .payload(updatedRequestBody) .build(); return request; }