Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static void init(Context ctx) {
USERNAME = json.getString("username");
ACCOUNT_NAME = json.getString("display_name");
USER_ID = json.getString("user_id");
LOGIN_URL = json.getString("test_login_domain");
LOGIN_URL = ensureHttpsPrefix(json.getString("test_login_domain"));
INSTANCE_URL = json.getString("instance_url");
API_INSTANCE_URL = JSONObjectHelper.optString(json, "api_instance_url");
COMMUNITY_URL = json.optString("community_url", INSTANCE_URL /* in case the test_credentials.json was obtained for a user / org without community setup */);
Expand All @@ -94,7 +94,7 @@ public static void init(String creds, Context ctx) {
USERNAME = json.getString("username");
ACCOUNT_NAME = json.getString("display_name");
USER_ID = json.getString("user_id");
LOGIN_URL = json.getString("test_login_domain");
LOGIN_URL = ensureHttpsPrefix(json.getString("test_login_domain"));
INSTANCE_URL = json.getString("instance_url");
COMMUNITY_URL = json.optString("community_url", INSTANCE_URL /* In case the test_credentials.json was obtained for a user/org without community setup */);
IDENTITY_URL = json.getString("identity_url");
Expand All @@ -108,4 +108,10 @@ public static void init(String creds, Context ctx) {
throw new RuntimeException(e);
}
}

private static String ensureHttpsPrefix(String url) {
if (url == null) return null;
if (url.startsWith("https://") || url.startsWith("http://")) return url;
return "https://" + url;
}
}
Loading