Skip to content

Commit 89dc10d

Browse files
committed
Clarify comments and parameter names
1 parent 924cafd commit 89dc10d

File tree

1 file changed

+6
-6
lines changed
  • WordPressUtils/src/main/java/org/wordpress/android/util

1 file changed

+6
-6
lines changed

WordPressUtils/src/main/java/org/wordpress/android/util/UrlUtils.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,25 +86,25 @@ public static String removeLeadingDoubleSlash(String url, String scheme) {
8686
* http client will work as expected.
8787
*
8888
* @param url url entered by the user or fetched from a server
89-
* @param isHTTPS true will make the url starts with https://
90-
* @return transformed url prefixed by its http:// or https:// scheme
89+
* @param addHttps true and the url is not starting with http://, it will make the url starts with https://
90+
* @return url prefixed by http:// or https://
9191
*/
92-
public static String addUrlSchemeIfNeeded(String url, boolean isHttps) {
92+
public static String addUrlSchemeIfNeeded(String url, boolean addHttps) {
9393
if (url == null) {
9494
return null;
9595
}
9696

9797
// Remove leading double slash (eg. //example.com), needed for some wporg instances configured to
9898
// switch between http or https
99-
url = removeLeadingDoubleSlash(url, (isHttps ? "https" : "http") + "://");
99+
url = removeLeadingDoubleSlash(url, (addHttps ? "https" : "http") + "://");
100100

101101
// If the URL is a valid http or https URL, we're good to go
102102
if (URLUtil.isHttpUrl(url) || URLUtil.isHttpsUrl(url)) {
103103
return url;
104104
}
105105

106-
// Else, remove the old scheme and add prefix it by https:// or http://
107-
return (isHttps ? "https" : "http") + "://" + removeScheme(url);
106+
// Else, remove the old scheme and prefix it by https:// or http://
107+
return (addHttps ? "https" : "http") + "://" + removeScheme(url);
108108
}
109109

110110
/**

0 commit comments

Comments
 (0)