diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java index fc970891..dd4fdf37 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java @@ -381,16 +381,19 @@ public class OwnCloudClient extends HttpClient { * cannot be invalidated with the given arguments. */ private boolean shouldInvalidateAccountCredentials(int httpStatusCode) { + boolean isServerVersionSupported = AccountUtils.getServerVersionForAccount(getAccount().getSavedAccount(), + getContext()).isServerVersionSupported(); - boolean should = (httpStatusCode == HttpConstants.HTTP_UNAUTHORIZED); // invalid credentials + boolean shouldInvalidateAccountCredentials = + (httpStatusCode == HttpConstants.HTTP_UNAUTHORIZED || !isServerVersionSupported); - should &= (mCredentials != null && // real credentials + shouldInvalidateAccountCredentials &= (mCredentials != null && // real credentials !(mCredentials instanceof OwnCloudCredentialsFactory.OwnCloudAnonymousCredentials)); // test if have all the needed to effectively invalidate ... - should &= (mAccount != null && mAccount.getSavedAccount() != null && getContext() != null); + shouldInvalidateAccountCredentials &= (mAccount != null && mAccount.getSavedAccount() != null && getContext() != null); - return should; + return shouldInvalidateAccountCredentials; } /** diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/OwnCloudVersion.kt b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/OwnCloudVersion.kt index d71114fb..5cadbcf9 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/OwnCloudVersion.kt +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/status/OwnCloudVersion.kt @@ -45,8 +45,8 @@ class OwnCloudVersion(version: String) : Comparable, Parcelable INVALID_ZERO_VERSION } - val isVersionLowerThan10: Boolean - get() = mVersion < VERSION_10 + val isServerVersionSupported: Boolean + get() = mVersion >= MINIMUN_VERSION_SUPPORTED val isPublicSharingWriteOnlySupported: Boolean get() = mVersion >= MINIMUM_VERSION_WITH_WRITE_ONLY_PUBLIC_SHARING @@ -144,6 +144,8 @@ class OwnCloudVersion(version: String) : Comparable, Parcelable private const val MINIMUM_VERSION_WITH_WRITE_ONLY_PUBLIC_SHARING = 0xA000100 // 10.0.1 + private const val MINIMUN_VERSION_SUPPORTED = 0xA000000 // 10.0.0 + private const val INVALID_ZERO_VERSION = "0.0.0" private const val MAX_DOTS = 3