mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +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() { | ||||
| 
 | ||||
| 		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); | ||||
| //    	refreshOperation.execute(mClient, this, mHandler); | ||||
|     } | ||||
|  | ||||
| @ -1,19 +1,19 @@ | ||||
| package com.owncloud.android.lib.refactor; | ||||
| 
 | ||||
| import android.annotation.TargetApi; | ||||
| import android.net.Uri; | ||||
| import android.os.Build; | ||||
| 
 | ||||
| import java.io.IOException; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| import at.bitfire.dav4android.UrlUtils; | ||||
| import okhttp3.HttpUrl; | ||||
| import okhttp3.Interceptor; | ||||
| import okhttp3.OkHttpClient; | ||||
| import okhttp3.Request; | ||||
| import okhttp3.Response; | ||||
| 
 | ||||
| public abstract class RemoteOperation { | ||||
|     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; | ||||
| 
 | ||||
|     protected RemoteOperation(OCContext context) { | ||||
| @ -46,24 +46,13 @@ public abstract class RemoteOperation { | ||||
|         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) { | ||||
|         return HttpUrl.parse( | ||||
|         return UrlUtils.INSTANCE.omitTrailingSlash(HttpUrl.parse( | ||||
|                 getBaseUriBuilder() | ||||
|                         .appendEncodedPath(WEBDAV_PATH_4_0) | ||||
|                         .appendEncodedPath(resourcePath) | ||||
|                         .build() | ||||
|                 .toString()); | ||||
|                         .toString())); | ||||
|     } | ||||
| 
 | ||||
|     protected Request.Builder getRequestBuilder() { | ||||
| @ -73,8 +62,7 @@ public abstract class RemoteOperation { | ||||
|     private Request.Builder addRequestCredentials(Request request) { | ||||
|         Request.Builder builder =  request.newBuilder(); | ||||
| 
 | ||||
|         for(Map.Entry<String, String> header | ||||
|                 : mContext.getOCAccount() | ||||
|         for(Map.Entry<String, String> header : mContext.getOCAccount() | ||||
|                 .getCredentials() | ||||
|                 .getCredentialHeaders() | ||||
|                 .entrySet()) { | ||||
|  | ||||
| @ -1,19 +1,11 @@ | ||||
| package com.owncloud.android.lib.refactor.operations; | ||||
| 
 | ||||
| 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.RemoteOperationResult; | ||||
| import java.io.IOException; | ||||
| import java.util.logging.Logger; | ||||
| 
 | ||||
| import at.bitfire.dav4android.Constants; | ||||
| import at.bitfire.dav4android.DavResource; | ||||
| import at.bitfire.dav4android.exception.DavException; | ||||
| import at.bitfire.dav4android.exception.HttpException; | ||||
| import at.bitfire.dav4android.property.DisplayName; | ||||
| import okhttp3.HttpUrl; | ||||
| import okhttp3.OkHttpClient; | ||||
| 
 | ||||
| public class PropfindOperation extends RemoteOperation { | ||||
| 
 | ||||
| @ -29,7 +21,6 @@ public class PropfindOperation extends RemoteOperation { | ||||
|     public RemoteOperationResult exec() { | ||||
| 
 | ||||
|         try { | ||||
|             HttpUrl location = HttpUrl.parse(getBaseUriBuilder().build().toString()); | ||||
| 
 | ||||
|             DavResource davResource = new DavResource(getClient(), getWebDavHttpUrl("/")); | ||||
|             davResource.propfind(0, DisplayName.NAME); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user