mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Code revision suggestions have been implemented.
This commit is contained in:
parent
f14abb0bcd
commit
3c46c95ac1
@ -126,10 +126,18 @@ class CreateRemoteShareOperation(
|
||||
Timber.d("Successful response: $response")
|
||||
result.data = parseResponse(response!!)
|
||||
Timber.d("*** Creating new remote share operation completed ")
|
||||
return result
|
||||
|
||||
val emptyShare = result.data.shares.first()
|
||||
|
||||
return if (retrieveShareDetails) {
|
||||
// retrieve more info - PUT only returns the index of the new share
|
||||
GetRemoteShareOperation(emptyShare.id).execute(client)
|
||||
} else {
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
private fun createFormBodyBuilder(): FormBody {
|
||||
private fun createFormBody(): FormBody {
|
||||
|
||||
val formBodyBuilder = FormBody.Builder()
|
||||
.add(PARAM_PATH, remoteFilePath)
|
||||
@ -164,7 +172,7 @@ class CreateRemoteShareOperation(
|
||||
override fun run(client: OwnCloudClient): RemoteOperationResult<ShareResponse> {
|
||||
val requestUri = buildRequestUri(client.baseUri)
|
||||
|
||||
val postMethod = PostMethod(URL(requestUri.toString()), createFormBodyBuilder()).apply {
|
||||
val postMethod = PostMethod(URL(requestUri.toString()), createFormBody()).apply {
|
||||
setRequestHeader(HttpConstants.CONTENT_TYPE_HEADER, HttpConstants.CONTENT_TYPE_URLENCODED_UTF8)
|
||||
addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE)
|
||||
}
|
||||
|
@ -161,11 +161,11 @@ class UpdateRemoteShareOperation
|
||||
|
||||
// Parameters to update
|
||||
if (name != null) {
|
||||
formBodyBuilder.add(PARAM_NAME, name!!)
|
||||
formBodyBuilder.add(PARAM_NAME, name.orEmpty())
|
||||
}
|
||||
|
||||
if (password != null) {
|
||||
formBodyBuilder.add(PARAM_PASSWORD, password!!)
|
||||
formBodyBuilder.add(PARAM_PASSWORD, password.orEmpty())
|
||||
}
|
||||
|
||||
if (expirationDateInMillis < INITIAL_EXPIRATION_DATE_IN_MILLIS) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user