Skip to content

Commit c5dd045

Browse files
committed
Fix for oC10 deep links to files located in the root folder
1 parent c3bb396 commit c5dd045

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/GetRemotePathForFileIdOperation.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@ class GetRemotePathForFileIdOperation(val fileId: String) : RemoteOperation<Remo
4040
val status = client.executeHttpMethod(headMethod)
4141
if (isSuccess(status)) {
4242
RemoteOperationResult<RemoteMetaFile>(RemoteOperationResult.ResultCode.OK).apply {
43-
var fileName = headMethod.response.request.url.queryParameter(SCROLL_TO_QUERY)
44-
fileName = if (fileName != null) {
45-
"${headMethod.response.request.url.queryParameter(DIR_QUERY)}/$fileName"
43+
val fileName = headMethod.response.request.url.queryParameter(SCROLL_TO_QUERY)
44+
val dirName = headMethod.response.request.url.queryParameter(DIR_QUERY)
45+
val remotePath = if (fileName != null) {
46+
"$dirName${if (dirName != "/") "/" else ""}$fileName"
4647
} else {
47-
headMethod.response.request.url.queryParameter(DIR_QUERY)
48+
dirName
4849
}
49-
data = RemoteMetaFile(metaPathForUser = fileName)
50+
data = RemoteMetaFile(metaPathForUser = remotePath)
5051
}
5152
} else {
5253
RemoteOperationResult<RemoteMetaFile>(headMethod)

0 commit comments

Comments
 (0)