Chromium Code Reviews| 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..3d68b6d8d487a074a701440a72b6ea4e7fea0d59 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()) |
|
markusheintz_
2011/05/26 09:45:23
Nit: I'd prefere (result.length() == 0) here as it
|
| + 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); |