Index: chrome/browser/policy/policy_path_parser_win.cc |
diff --git a/chrome/browser/policy/policy_path_parser_win.cc b/chrome/browser/policy/policy_path_parser_win.cc |
index 89c3a446f4ac057631a2aac7d80c36c0e98737d2..6021d25eec94df194e22183dfdd95200271d2245 100644 |
--- a/chrome/browser/policy/policy_path_parser_win.cc |
+++ b/chrome/browser/policy/policy_path_parser_win.cc |
@@ -44,6 +44,15 @@ const WinFolderNamesToCSIDLMapping win_folder_mapping[] = { |
FilePath::StringType ExpandPathVariables( |
const FilePath::StringType& untranslated_string) { |
FilePath::StringType result(untranslated_string); |
+ if (!result.length()) |
+ return result; |
+ // Sanitize quotes in case of any around the whole string. |
+ if (result.length() > 1 && |
+ ((result[0] == L'"' && result[result.length() - 1] == L'"') || |
+ (result[0] == L'\'' && result[result.length() - 1] == L'\''))) { |
+ // Strip first and last char which should be matching quotes now. |
+ result = result.substr(1, result.length() - 2); |
+ } |
// First translate all path variables we recognize. |
for (int i = 0; i < arraysize(win_folder_mapping); ++i) { |
size_t position = result.find(win_folder_mapping[i].name); |