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

Fix browse files with username containing @ character

This commit is contained in:
davigonz 2018-11-21 16:58:46 +01:00
parent 3b551ea439
commit b523062740

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) {
final String davPath = WEBDAV_FILES_PATH_4_0 + Uri.encode(userId);
final String pathToOc = url.encodedPath().split(davPath)[0];
return Uri.decode(url.encodedPath().replace(pathToOc + davPath, ""));
final String davFilesPath = WEBDAV_FILES_PATH_4_0 + userId;
final String absoluteDavPath = Uri.decode(url.encodedPath());
final String pathToOc = absoluteDavPath.split(davFilesPath)[0];
return absoluteDavPath.replace(pathToOc + davFilesPath, "");
}
/**