Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Unified Diff: chrome/browser/google_apis/drive_api_util.cc

Issue 14352007: Escape backslash (\x5C) for string value of search query. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/google_apis/drive_api_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/google_apis/drive_api_util.cc
diff --git a/chrome/browser/google_apis/drive_api_util.cc b/chrome/browser/google_apis/drive_api_util.cc
index 10597c3c7e5fe870bcee90b711ba50f4555fc93f..51700f382c3dd15ace72f29cffeeead8ab1d600d 100644
--- a/chrome/browser/google_apis/drive_api_util.cc
+++ b/chrome/browser/google_apis/drive_api_util.cc
@@ -23,7 +23,13 @@ namespace util {
std::string EscapeQueryStringValue(const std::string& str) {
std::string result;
- ReplaceChars(str, "'", "\\'", &result);
+ result.reserve(str.size());
+ for (size_t i = 0; i < str.size(); ++i) {
+ if (str[i] == '\\' || str[i] == '\'') {
+ result.push_back('\\');
+ }
+ result.push_back(str[i]);
+ }
return result;
}
« no previous file with comments | « no previous file | chrome/browser/google_apis/drive_api_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698