Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Unified Diff: shell/filename_util.cc

Issue 868963002: Simplify resolution of mojo: URLs. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Name fix Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« shell/context.h ('K') | « shell/filename_util.h ('k') | shell/mojo_url_resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698