This repository was archived by the owner on Mar 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
owncloudComLibrary/src/main/java/com/owncloud/android/lib Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -184,6 +184,7 @@ public class HttpConstants {
184
184
public static final int HTTP_LOCKED = 423 ;
185
185
// 424 Failed Dependency (WebDAV - RFC 2518)
186
186
public static final int HTTP_FAILED_DEPENDENCY = 424 ;
187
+ public static final int HTTP_TOO_EARLY = 425 ;
187
188
188
189
/**
189
190
* 5xx Client Error
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ public RemoteFile(String path) {
120
120
121
121
public RemoteFile (final Response davResource , String userId ) {
122
122
this (RemoteFileUtil .Companion .getRemotePathFromUrl (davResource .getHref (), userId ));
123
- final List <Property > properties = davResource . getProperties ();
123
+ final List <Property > properties = RemoteFileUtil . Companion . getProperties (davResource );
124
124
125
125
for (Property property : properties ) {
126
126
if (property instanceof CreationDate ) {
Original file line number Diff line number Diff line change 24
24
package com.owncloud.android.lib.resources.files
25
25
26
26
import android.net.Uri
27
+ import at.bitfire.dav4jvm.PropStat
28
+ import at.bitfire.dav4jvm.Property
29
+ import at.bitfire.dav4jvm.Response
27
30
import com.owncloud.android.lib.common.OwnCloudClient
31
+ import com.owncloud.android.lib.common.http.HttpConstants
28
32
import okhttp3.HttpUrl
29
33
30
34
class RemoteFileUtil {
@@ -45,5 +49,14 @@ class RemoteFileUtil {
45
49
val pathToOc = absoluteDavPath.split(davFilesPath)[0 ]
46
50
return absoluteDavPath.replace(pathToOc + davFilesPath, " " )
47
51
}
52
+
53
+ fun getProperties (response : Response ): List <Property > {
54
+ return if (response.isSuccess())
55
+ response.propstat.filter { propStat -> propStat.isSuccessOrPostProcessing() }.map { it.properties }.flatten()
56
+ else
57
+ emptyList()
58
+ }
59
+
60
+ private fun PropStat.isSuccessOrPostProcessing () = (status.code / 100 == 2 || status.code == HttpConstants .HTTP_TOO_EARLY )
48
61
}
49
62
}
You can’t perform that action at this time.
0 commit comments