Merge pull request #453 from owncloud/improve_action_bar_pr_392_with_develop
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / DetectAuthenticationMethodOperation.java
index 560109f..c670316 100644 (file)
@@ -95,9 +95,11 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
         
         // try to access the root folder, following redirections but not SAML SSO redirections
         result = operation.execute(client);
         
         // try to access the root folder, following redirections but not SAML SSO redirections
         result = operation.execute(client);
-        while (result.isTemporalRedirection() && !result.isIdPRedirection()) {
+        String redirectedLocation = result.getRedirectedLocation(); 
+        while (redirectedLocation != null && redirectedLocation.length() > 0 && !result.isIdPRedirection()) {
             client.setWebdavUri(Uri.parse(result.getRedirectedLocation()));
             result = operation.execute(client);
             client.setWebdavUri(Uri.parse(result.getRedirectedLocation()));
             result = operation.execute(client);
+            redirectedLocation = result.getRedirectedLocation();
         } 
 
         // analyze response  
         } 
 
         // analyze response