This repository was archived by the owner on Mar 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +21
-2
lines changed
owncloudComLibrary/src/main/java/com/owncloud/android/lib Expand file tree Collapse file tree 4 files changed +21
-2
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 @@ -237,6 +237,10 @@ public RemoteOperationResult(HttpBaseMethod httpMethod) throws IOException {
237
237
httpMethod .getResponseBodyAsString (),
238
238
ResultCode .SPECIFIC_METHOD_NOT_ALLOWED
239
239
);
240
+ break ;
241
+ case HttpConstants .HTTP_TOO_EARLY :
242
+ mCode = ResultCode .TOO_EARLY ;
243
+ break ;
240
244
default :
241
245
break ;
242
246
}
@@ -583,6 +587,7 @@ public enum ResultCode {
583
587
SPECIFIC_SERVICE_UNAVAILABLE ,
584
588
SPECIFIC_UNSUPPORTED_MEDIA_TYPE ,
585
589
SPECIFIC_METHOD_NOT_ALLOWED ,
586
- SPECIFIC_BAD_REQUEST
590
+ SPECIFIC_BAD_REQUEST ,
591
+ TOO_EARLY ,
587
592
}
588
593
}
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