Skip to content

Commit

Permalink
Restore userID encoding when building files DAV uri
Browse files Browse the repository at this point in the history
Mistakenly removed in previous changes

Signed-off-by: Álvaro Brey <[email protected]>
  • Loading branch information
AlvaroBrey authored and backportbot-nextcloud[bot] committed May 5, 2022
1 parent 1b97363 commit ccdd5a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class NextcloudClient private constructor(
}

fun getUserIdEncoded(): String {
return UserIdEncoder.encode(delegate.userId!!)
return delegate.userIdEncoded!!
}

fun getUserIdPlain(): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class NextcloudUriDelegate(baseUri: Uri, var userId: String?) : NextcloudUriProv

constructor(baseUri: Uri) : this(baseUri, null)

val userIdEncoded: String?
get() = userId?.let { UserIdEncoder.encode(it) }

/**
* Root URI of the Nextcloud server
*/
Expand All @@ -51,7 +54,7 @@ class NextcloudUriDelegate(baseUri: Uri, var userId: String?) : NextcloudUriProv
}

override val filesDavUri: Uri
get() = Uri.parse("$davUri/files/$userId")
get() = Uri.parse("$davUri/files/$userIdEncoded")
override val uploadUri: Uri
get() = Uri.parse(baseUri.toString() + AccountUtils.DAV_UPLOAD)
override val davUri: Uri
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,7 @@ private void logCookie(Cookie cookie) {
* @return uri-encoded userId
*/
public String getUserId() {
final String userId = nextcloudUriDelegate.getUserId();
if (userId == null) {
return null;
}
return UserIdEncoder.encode(userId);
return nextcloudUriDelegate.getUserIdEncoded();
}

public String getUserIdPlain() {
Expand Down

0 comments on commit ccdd5a5

Please sign in to comment.