This repository was archived by the owner on Jul 25, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
app/src/main/java/com/zulip/android/activities Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -197,14 +197,17 @@ private void showBackends(String httpScheme, String serverURL) {
197
197
198
198
serverUri = serverUri .buildUpon ().scheme (httpScheme ).build ();
199
199
200
- // if does not begin with "api.zulip.com" and if the path is empty, use "/api" as first segment in the path
201
- List <String > paths = serverUri .getPathSegments ();
202
- if (!serverUri .getHost ().startsWith ("api." ) && paths .isEmpty ()) {
203
- serverUri = serverUri .buildUpon ().appendEncodedPath ("api/" ).build ();
204
- }
200
+ // display server url with http scheme used
205
201
serverIn .setText (serverUri .toString ());
206
202
mServerEditText .setText (serverUri .toString ());
207
203
mServerEditText .setEnabled (false );
204
+
205
+ // if server url does not end with "api/" or if the path is empty, use "/api" as last segment in the path
206
+ List <String > paths = serverUri .getPathSegments ();
207
+ if (paths .isEmpty () || !paths .get (paths .size () - 1 ).equals ("api" )) {
208
+ serverUri = serverUri .buildUpon ().appendEncodedPath ("api/" ).build ();
209
+ }
210
+
208
211
((ZulipApp ) getApplication ()).setServerURL (serverUri .toString ());
209
212
210
213
// create new zulipServices object every time by setting it to null
You can’t perform that action at this time.
0 commit comments