From 5db043f7d430f573ff61c84ebbb25d9caa8687f7 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Mon, 8 Apr 2013 12:42:37 -0400 Subject: [PATCH] Strip whitespace from the application name in the user agent Having whitespace in the application name makes the user agent hard to parse. --- brightray/common/content_client.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/brightray/common/content_client.cc b/brightray/common/content_client.cc index 5e9877da5aa..e976cdb03ad 100644 --- a/brightray/common/content_client.cc +++ b/brightray/common/content_client.cc @@ -7,6 +7,7 @@ #include "common/application_info.h" #include "base/stringprintf.h" +#include "base/string_util.h" #include "ui/base/resource/resource_bundle.h" #include "webkit/user_agent/user_agent_util.h" @@ -19,7 +20,9 @@ ContentClient::~ContentClient() { } std::string ContentClient::GetProduct() const { - return base::StringPrintf("%s/%s", GetApplicationName().c_str(), GetApplicationVersion().c_str()); + auto name = GetApplicationName(); + RemoveChars(name, kWhitespaceASCII, &name); + return base::StringPrintf("%s/%s", name.c_str(), GetApplicationVersion().c_str()); } std::string ContentClient::GetUserAgent() const {