From 02c24c8a3bd87382590ece0e0744ad430718b51a Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Thu, 2 Jul 2015 14:02:31 +0200 Subject: [PATCH] Fixed existence check on files when automatic redirections are explicitly disabled (SAML SSO) --- .../resources/files/ExistenceCheckRemoteOperation.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/com/owncloud/android/lib/resources/files/ExistenceCheckRemoteOperation.java b/src/com/owncloud/android/lib/resources/files/ExistenceCheckRemoteOperation.java index 4596594b..71a2e46f 100644 --- a/src/com/owncloud/android/lib/resources/files/ExistenceCheckRemoteOperation.java +++ b/src/com/owncloud/android/lib/resources/files/ExistenceCheckRemoteOperation.java @@ -83,9 +83,11 @@ public class ExistenceCheckRemoteOperation extends RemoteOperation { try { head = new HeadMethod(client.getWebdavUri() + WebdavUtils.encodePath(mPath)); client.setFollowRedirects(false); - client.executeMethod(head, TIMEOUT, TIMEOUT); - mRedirectionPath = client.followRedirection(head); - int status = mRedirectionPath.getLastStatus(); + int status = client.executeMethod(head, TIMEOUT, TIMEOUT); + if (previousFollowRedirects) { + mRedirectionPath = client.followRedirection(head); + status = mRedirectionPath.getLastStatus(); + } client.exhaustResponse(head.getResponseBodyAsStream()); boolean success = (status == HttpStatus.SC_OK && !mSuccessIfAbsent) || (status == HttpStatus.SC_NOT_FOUND && mSuccessIfAbsent);