Index: shell/filename_util.cc |
diff --git a/shell/filename_util.cc b/shell/filename_util.cc |
index 9ef0358aab16a80ce800555efa36bd0610015154..8c1e8ae23a3a0b4c39e25f6f0ec7001bf264a49a 100644 |
--- a/shell/filename_util.cc |
+++ b/shell/filename_util.cc |
@@ -57,4 +57,14 @@ GURL FilePathToFileURL(const base::FilePath& path) { |
return GURL(url_string); |
} |
+GURL AddTrailingSlashIfNeeded(const GURL& url) { |
+ if (!url.has_path() || *url.path().rbegin() == '/') |
+ return url; |
+ |
+ std::string path(url.path() + '/'); |
+ GURL::Replacements replacements; |
+ replacements.SetPathStr(path); |
+ return url.ReplaceComponents(replacements); |
+} |
+ |
} // namespace mojo |