1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Merge pull request #216 from owncloud/release_0.9.24

Release 0.9.24
This commit is contained in:
David González Verdugo 2018-11-26 12:37:51 +01:00 committed by GitHub
commit c85fe7549c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -226,11 +226,20 @@ public class RemoteFile implements Parcelable, Serializable {
} }
} }
/**
* Retrieves a relative path from a remote file url
*
* Example: url:port/remote.php/dav/files/username/Documents/text.txt => /Documents/text.txt
*
* @param url remote file url
* @param userId file owner
* @return remote relative path of the file
*/
private static String getRemotePathFromUrl(HttpUrl url, String userId) { private static String getRemotePathFromUrl(HttpUrl url, String userId) {
final String davPath = WEBDAV_FILES_PATH_4_0 + Uri.encode(userId); final String davFilesPath = WEBDAV_FILES_PATH_4_0 + userId;
final String pathToOc = url.encodedPath().split(davPath)[0]; final String absoluteDavPath = Uri.decode(url.encodedPath());
return Uri.decode(url.encodedPath().replace(pathToOc + davPath, "")); final String pathToOc = absoluteDavPath.split(davFilesPath)[0];
return absoluteDavPath.replace(pathToOc + davFilesPath, "");
} }
/** /**