This repository was archived by the owner on Mar 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/shares Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -126,10 +126,18 @@ class CreateRemoteShareOperation(
126
126
Timber .d(" Successful response: $response " )
127
127
result.data = parseResponse(response!! )
128
128
Timber .d(" *** Creating new remote share operation completed " )
129
- return result
129
+
130
+ val emptyShare = result.data.shares.first()
131
+
132
+ return if (retrieveShareDetails) {
133
+ // retrieve more info - PUT only returns the index of the new share
134
+ GetRemoteShareOperation (emptyShare.id).execute(client)
135
+ } else {
136
+ result
137
+ }
130
138
}
131
139
132
- private fun createFormBodyBuilder (): FormBody {
140
+ private fun createFormBody (): FormBody {
133
141
134
142
val formBodyBuilder = FormBody .Builder ()
135
143
.add(PARAM_PATH , remoteFilePath)
@@ -164,7 +172,7 @@ class CreateRemoteShareOperation(
164
172
override fun run (client : OwnCloudClient ): RemoteOperationResult <ShareResponse > {
165
173
val requestUri = buildRequestUri(client.baseUri)
166
174
167
- val postMethod = PostMethod (URL (requestUri.toString()), createFormBodyBuilder ()).apply {
175
+ val postMethod = PostMethod (URL (requestUri.toString()), createFormBody ()).apply {
168
176
setRequestHeader(HttpConstants .CONTENT_TYPE_HEADER , HttpConstants .CONTENT_TYPE_URLENCODED_UTF8 )
169
177
addRequestHeader(OCS_API_HEADER , OCS_API_HEADER_VALUE )
170
178
}
Original file line number Diff line number Diff line change @@ -161,11 +161,11 @@ class UpdateRemoteShareOperation
161
161
162
162
// Parameters to update
163
163
if (name != null ) {
164
- formBodyBuilder.add(PARAM_NAME , name!! )
164
+ formBodyBuilder.add(PARAM_NAME , name.orEmpty() )
165
165
}
166
166
167
167
if (password != null ) {
168
- formBodyBuilder.add(PARAM_PASSWORD , password!! )
168
+ formBodyBuilder.add(PARAM_PASSWORD , password.orEmpty() )
169
169
}
170
170
171
171
if (expirationDateInMillis < INITIAL_EXPIRATION_DATE_IN_MILLIS ) {
You can’t perform that action at this time.
0 commit comments