mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-08 00:16:09 +00:00
Remove unneeded slahes in url
This commit is contained in:
parent
ca2eff6647
commit
a4678557d8
@ -158,8 +158,8 @@ public class MainActivity extends Activity implements OnRemoteOperationListener,
|
|||||||
private void startRefresh() {
|
private void startRefresh() {
|
||||||
|
|
||||||
final PropfindOperation propfindOperation = new PropfindOperation(mOCContext, FileUtils.PATH_SEPARATOR);
|
final PropfindOperation propfindOperation = new PropfindOperation(mOCContext, FileUtils.PATH_SEPARATOR);
|
||||||
|
new Thread(() -> propfindOperation.exec()).start();
|
||||||
|
|
||||||
Thread tread = new Thread(() -> propfindOperation.exec());
|
|
||||||
// ReadRemoteFolderOperation refreshOperation = new ReadRemoteFolderOperation(FileUtils.PATH_SEPARATOR);
|
// ReadRemoteFolderOperation refreshOperation = new ReadRemoteFolderOperation(FileUtils.PATH_SEPARATOR);
|
||||||
// refreshOperation.execute(mClient, this, mHandler);
|
// refreshOperation.execute(mClient, this, mHandler);
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
package com.owncloud.android.lib.refactor;
|
package com.owncloud.android.lib.refactor;
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import at.bitfire.dav4android.UrlUtils;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
import okhttp3.Interceptor;
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
|
||||||
|
|
||||||
public abstract class RemoteOperation {
|
public abstract class RemoteOperation {
|
||||||
private final OCContext mContext;
|
private final OCContext mContext;
|
||||||
private static final String WEBDAV_PATH_4_0 = "/remote.php/dav";
|
private static final String WEBDAV_PATH_4_0 = "remote.php/dav";
|
||||||
private static OkHttpClient mClient = null;
|
private static OkHttpClient mClient = null;
|
||||||
|
|
||||||
protected RemoteOperation(OCContext context) {
|
protected RemoteOperation(OCContext context) {
|
||||||
@ -46,24 +46,13 @@ public abstract class RemoteOperation {
|
|||||||
return mContext.getOCAccount().getBaseUri().buildUpon();
|
return mContext.getOCAccount().getBaseUri().buildUpon();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Uri getWebDavUrl() {
|
|
||||||
return getBaseUriBuilder().appendEncodedPath(WEBDAV_PATH_4_0).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Uri getWebDavUri(String resourcePath) {
|
|
||||||
return getBaseUriBuilder()
|
|
||||||
.appendEncodedPath(WEBDAV_PATH_4_0)
|
|
||||||
.appendEncodedPath(resourcePath)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected HttpUrl getWebDavHttpUrl(String resourcePath) {
|
protected HttpUrl getWebDavHttpUrl(String resourcePath) {
|
||||||
return HttpUrl.parse(
|
return UrlUtils.INSTANCE.omitTrailingSlash(HttpUrl.parse(
|
||||||
getBaseUriBuilder()
|
getBaseUriBuilder()
|
||||||
.appendEncodedPath(WEBDAV_PATH_4_0)
|
.appendEncodedPath(WEBDAV_PATH_4_0)
|
||||||
.appendEncodedPath(resourcePath)
|
.appendEncodedPath(resourcePath)
|
||||||
.build()
|
.build()
|
||||||
.toString());
|
.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Request.Builder getRequestBuilder() {
|
protected Request.Builder getRequestBuilder() {
|
||||||
@ -73,8 +62,7 @@ public abstract class RemoteOperation {
|
|||||||
private Request.Builder addRequestCredentials(Request request) {
|
private Request.Builder addRequestCredentials(Request request) {
|
||||||
Request.Builder builder = request.newBuilder();
|
Request.Builder builder = request.newBuilder();
|
||||||
|
|
||||||
for(Map.Entry<String, String> header
|
for(Map.Entry<String, String> header : mContext.getOCAccount()
|
||||||
: mContext.getOCAccount()
|
|
||||||
.getCredentials()
|
.getCredentials()
|
||||||
.getCredentialHeaders()
|
.getCredentialHeaders()
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
|
@ -1,19 +1,11 @@
|
|||||||
package com.owncloud.android.lib.refactor.operations;
|
package com.owncloud.android.lib.refactor.operations;
|
||||||
|
|
||||||
import com.owncloud.android.lib.refactor.OCContext;
|
import com.owncloud.android.lib.refactor.OCContext;
|
||||||
import com.owncloud.android.lib.common.network.WebdavUtils;
|
|
||||||
import com.owncloud.android.lib.refactor.RemoteOperation;
|
import com.owncloud.android.lib.refactor.RemoteOperation;
|
||||||
import com.owncloud.android.lib.refactor.RemoteOperationResult;
|
import com.owncloud.android.lib.refactor.RemoteOperationResult;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import at.bitfire.dav4android.Constants;
|
|
||||||
import at.bitfire.dav4android.DavResource;
|
import at.bitfire.dav4android.DavResource;
|
||||||
import at.bitfire.dav4android.exception.DavException;
|
|
||||||
import at.bitfire.dav4android.exception.HttpException;
|
|
||||||
import at.bitfire.dav4android.property.DisplayName;
|
import at.bitfire.dav4android.property.DisplayName;
|
||||||
import okhttp3.HttpUrl;
|
|
||||||
import okhttp3.OkHttpClient;
|
|
||||||
|
|
||||||
public class PropfindOperation extends RemoteOperation {
|
public class PropfindOperation extends RemoteOperation {
|
||||||
|
|
||||||
@ -29,7 +21,6 @@ public class PropfindOperation extends RemoteOperation {
|
|||||||
public RemoteOperationResult exec() {
|
public RemoteOperationResult exec() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
HttpUrl location = HttpUrl.parse(getBaseUriBuilder().build().toString());
|
|
||||||
|
|
||||||
DavResource davResource = new DavResource(getClient(), getWebDavHttpUrl("/"));
|
DavResource davResource = new DavResource(getClient(), getWebDavHttpUrl("/"));
|
||||||
davResource.propfind(0, DisplayName.NAME);
|
davResource.propfind(0, DisplayName.NAME);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user