Skip to content

Commit 965904f

Browse files
committed
feat: add /kwdav prefix before each requests except well-known and token requests
1 parent b5af5db commit 965904f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public class OwnCloudClient extends HttpClient {
5555
private static final String WEBDAV_UPLOADS_PATH_4_0 = "/remote.php/dav/uploads/";
5656
private static final String KONNECT_V1_TOKEN_PATH = "/konnect/v1/token";
5757
public static final String KWDAV_PATH = "/kwdav";
58+
private static final String WELL_KNOWN_PATH = "/.well-known";
59+
private static final String OAUTH_TOKEN_PATH = "/oauth/token";
5860
private static final int MAX_RETRY_COUNT = 2;
5961

6062
private static int sIntanceCounter = 0;
@@ -140,6 +142,14 @@ private int saveExecuteHttpMethod(HttpBaseMethod method) throws Exception {
140142
method.setRequestHeader(AUTHORIZATION_HEADER, mCredentials.getHeaderAuth());
141143
}
142144

145+
HttpUrl originalUrl = method.getHttpUrl();
146+
String encodedPath = originalUrl.encodedPath();
147+
if (mIsKiteworksServer && !encodedPath.startsWith(WELL_KNOWN_PATH) && !encodedPath.equals(OAUTH_TOKEN_PATH)) {
148+
HttpUrl newUrl = originalUrl.newBuilder().encodedPath(KWDAV_PATH + encodedPath).build();
149+
method.setUrl(newUrl);
150+
}
151+
152+
143153
status = method.execute(this);
144154

145155
if (shouldConnectionValidatorBeCalled(method, status)) {

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/methods/HttpBaseMethod.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ abstract class HttpBaseMethod constructor(url: URL) {
8484
}
8585

8686
open fun setUrl(url: HttpUrl) {
87+
httpUrl = url
8788
request = request.newBuilder()
8889
.url(url)
8990
.build()

0 commit comments

Comments
 (0)