Index: base/files/file_path.cc |
diff --git a/base/files/file_path.cc b/base/files/file_path.cc |
index c142db44b6174c7c5cf2f11d32d90652405c072b..18775ed9ca99acf7b6b61d21b2e44fbcbdbe0b0b 100644 |
--- a/base/files/file_path.cc |
+++ b/base/files/file_path.cc |
@@ -562,24 +562,18 @@ bool FilePath::ReferencesParent() const { |
std::vector<StringType> components; |
GetComponents(&components); |
- for (const StringType& component : components) { |
-#if defined(OS_WIN) |
+ std::vector<StringType>::const_iterator it = components.begin(); |
+ for (; it != components.end(); ++it) { |
+ const StringType& component = *it; |
// Windows has odd, undocumented behavior with path components containing |
// only whitespace and . characters. So, if all we see is . and |
// whitespace, then we treat any .. sequence as referencing parent. |
+ // For simplicity we enforce this on all platforms. |
if (component.find_first_not_of(FILE_PATH_LITERAL(". \n\r\t")) == |
std::string::npos && |
component.find(kParentDirectory) != std::string::npos) { |
- // Add a debug-only warning so Windows-specific bot failures are easier to |
- // diagnose. |
- DLOG_IF(WARNING, component != kParentDirectory) |
- << "Rejecting Windows-specific path component."; |
return true; |
} |
-#else |
- if (component == kParentDirectory) |
- return true; |
-#endif |
} |
return false; |
} |