mirror of
https://github.com/owncloud/android-library.git
synced 2025-07-09 23:48:45 +00:00
Compare commits
No commits in common. "c2f7426a3e7f92abf570442b685958fd7fe7ee88" and "376d52ac5bb8bb8c31a2502493771aa691ecf4d2" have entirely different histories.
c2f7426a3e
...
376d52ac5b
@ -184,7 +184,6 @@ public class HttpConstants {
|
|||||||
public static final int HTTP_LOCKED = 423;
|
public static final int HTTP_LOCKED = 423;
|
||||||
// 424 Failed Dependency (WebDAV - RFC 2518)
|
// 424 Failed Dependency (WebDAV - RFC 2518)
|
||||||
public static final int HTTP_FAILED_DEPENDENCY = 424;
|
public static final int HTTP_FAILED_DEPENDENCY = 424;
|
||||||
public static final int HTTP_TOO_EARLY = 425;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 5xx Client Error
|
* 5xx Client Error
|
||||||
|
@ -237,10 +237,6 @@ public class RemoteOperationResult<T>
|
|||||||
httpMethod.getResponseBodyAsString(),
|
httpMethod.getResponseBodyAsString(),
|
||||||
ResultCode.SPECIFIC_METHOD_NOT_ALLOWED
|
ResultCode.SPECIFIC_METHOD_NOT_ALLOWED
|
||||||
);
|
);
|
||||||
break;
|
|
||||||
case HttpConstants.HTTP_TOO_EARLY:
|
|
||||||
mCode = ResultCode.TOO_EARLY;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -587,7 +583,6 @@ public class RemoteOperationResult<T>
|
|||||||
SPECIFIC_SERVICE_UNAVAILABLE,
|
SPECIFIC_SERVICE_UNAVAILABLE,
|
||||||
SPECIFIC_UNSUPPORTED_MEDIA_TYPE,
|
SPECIFIC_UNSUPPORTED_MEDIA_TYPE,
|
||||||
SPECIFIC_METHOD_NOT_ALLOWED,
|
SPECIFIC_METHOD_NOT_ALLOWED,
|
||||||
SPECIFIC_BAD_REQUEST,
|
SPECIFIC_BAD_REQUEST
|
||||||
TOO_EARLY,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public class RemoteFile implements Parcelable, Serializable {
|
|||||||
|
|
||||||
public RemoteFile(final Response davResource, String userId) {
|
public RemoteFile(final Response davResource, String userId) {
|
||||||
this(RemoteFileUtil.Companion.getRemotePathFromUrl(davResource.getHref(), userId));
|
this(RemoteFileUtil.Companion.getRemotePathFromUrl(davResource.getHref(), userId));
|
||||||
final List<Property> properties = RemoteFileUtil.Companion.getProperties(davResource);
|
final List<Property> properties = davResource.getProperties();
|
||||||
|
|
||||||
for (Property property : properties) {
|
for (Property property : properties) {
|
||||||
if (property instanceof CreationDate) {
|
if (property instanceof CreationDate) {
|
||||||
|
@ -24,11 +24,7 @@
|
|||||||
package com.owncloud.android.lib.resources.files
|
package com.owncloud.android.lib.resources.files
|
||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import at.bitfire.dav4jvm.PropStat
|
|
||||||
import at.bitfire.dav4jvm.Property
|
|
||||||
import at.bitfire.dav4jvm.Response
|
|
||||||
import com.owncloud.android.lib.common.OwnCloudClient
|
import com.owncloud.android.lib.common.OwnCloudClient
|
||||||
import com.owncloud.android.lib.common.http.HttpConstants
|
|
||||||
import okhttp3.HttpUrl
|
import okhttp3.HttpUrl
|
||||||
|
|
||||||
class RemoteFileUtil {
|
class RemoteFileUtil {
|
||||||
@ -49,14 +45,5 @@ class RemoteFileUtil {
|
|||||||
val pathToOc = absoluteDavPath.split(davFilesPath)[0]
|
val pathToOc = absoluteDavPath.split(davFilesPath)[0]
|
||||||
return absoluteDavPath.replace(pathToOc + davFilesPath, "")
|
return absoluteDavPath.replace(pathToOc + davFilesPath, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getProperties(response: Response): List<Property> {
|
|
||||||
return if (response.isSuccess())
|
|
||||||
response.propstat.filter { propStat -> propStat.isSuccessOrPostProcessing() }.map { it.properties }.flatten()
|
|
||||||
else
|
|
||||||
emptyList()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun PropStat.isSuccessOrPostProcessing() = (status.code / 100 == 2 || status.code == HttpConstants.HTTP_TOO_EARLY)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user