Commit 27f09ae6 authored by Clemens Arbesser's avatar Clemens Arbesser Committed by Chromium LUCI CQ

[Autofill Assistant] Change expected base64 encoding to be url-safe.

Bug: b/175132318
Change-Id: I1b4116420dcd441b6ef089ed7f3c56a8f97048d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2582338Reviewed-by: default avatarLukasz Suder <lsuder@chromium.org>
Commit-Queue: Clemens Arbesser <arbesser@google.com>
Cr-Commit-Position: refs/heads/master@{#835300}
parent 5110aed3
......@@ -433,7 +433,7 @@ public class AutofillAssistantTriggerScriptIntegrationTest {
.build();
byte[] triggerScriptsResponse = triggerScripts.toByteArray();
String base64Response = Base64.encodeToString(triggerScriptsResponse, /* offset = */ 0,
triggerScriptsResponse.length, Base64.NO_WRAP);
triggerScriptsResponse.length, Base64.URL_SAFE | Base64.NO_WRAP);
Assert.assertEquals(0, base64Response.length() % 4);
startAutofillAssistantOnTabWithParams(
TEST_PAGE_A, Collections.singletonMap("TRIGGER_SCRIPTS_BASE64", base64Response));
......
......@@ -6,7 +6,7 @@
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
#include "base/base64.h"
#include "base/base64url.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantTriggerScriptBridge_jni.h"
#include "chrome/browser/android/autofill_assistant/assistant_header_model.h"
#include "chrome/browser/android/autofill_assistant/ui_controller_android_utils.h"
......@@ -54,9 +54,9 @@ void TriggerScriptBridgeAndroid::StartTriggerScript(
} else if (trigger_context->GetBase64TriggerScriptsResponseProto()
.has_value()) {
std::string response;
if (!base::Base64Decode(
if (!base::Base64UrlDecode(
trigger_context->GetBase64TriggerScriptsResponseProto().value(),
&response)) {
base::Base64UrlDecodePolicy::IGNORE_PADDING, &response)) {
LOG(ERROR) << "Failed to base64-decode trigger scripts response";
Metrics::RecordLiteScriptFinished(
ukm::UkmRecorder::Get(), client->GetWebContents(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment