Index: chrome/browser/policy/policy_path_parser_mac.mm |
diff --git a/chrome/browser/policy/policy_path_parser_mac.mm b/chrome/browser/policy/policy_path_parser_mac.mm |
index 48d0653c574ee8765c5b7d29b0508b9590cfe185..7f1d3dab2bec5cd5d5f753b43e78b71913c151af 100644 |
--- a/chrome/browser/policy/policy_path_parser_mac.mm |
+++ b/chrome/browser/policy/policy_path_parser_mac.mm |
@@ -38,6 +38,15 @@ const MacFolderNamesToSPDMaping mac_folder_mapping[] = { |
FilePath::StringType ExpandPathVariables( |
const FilePath::StringType& untranslated_string) { |
FilePath::StringType result(untranslated_string); |
+ if (result.length() == 0) |
+ return result; |
+ // Sanitize quotes in case of any around the whole string. |
+ if (result.length() > 1 && |
+ ((result[0] == '"' && result[result.length() - 1] == '"') || |
+ (result[0] == '\'' && result[result.length() - 1] == '\''))) { |
+ // 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 (size_t i = 0; i < arraysize(mac_folder_mapping); ++i) { |
size_t position = result.find(mac_folder_mapping[i].name); |