Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe114aa

Browse files
authored
Fix API errors (#183)
Signed-off-by: Milen Pivchev <[email protected]>
1 parent 2323b9f commit fe114aa

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

Sources/NextcloudKit/NextcloudKit+Share.swift

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ public extension NextcloudKit {
447447

448448
func updateShare(idShare: Int,
449449
password: String? = nil,
450-
expireDate: String? = nil,
450+
expireDate: String? = "",
451451
permissions: Int = 1,
452452
publicUpload: Bool? = nil,
453453
note: String? = nil,
@@ -464,19 +464,20 @@ public extension NextcloudKit {
464464
let headers = nkCommonInstance.getStandardHeaders(account: account, options: options) else {
465465
return options.queue.async { completion(account, nil, nil, .urlError) }
466466
}
467+
467468
var parameters = [
468469
"permissions": String(permissions)
469470
]
470-
if let password, !password.isEmpty {
471-
parameters["password"] = password
472-
}
473-
if let expireDate, !expireDate.isEmpty {
474-
parameters["expireDate"] = expireDate
475-
}
476-
if let note, !note.isEmpty {
471+
472+
parameters["password"] = password != nil ? password : ""
473+
474+
parameters["expireDate"] = expireDate != nil ? expireDate : ""
475+
476+
if let note {
477477
parameters["note"] = note
478478
}
479-
if let label, !label.isEmpty {
479+
480+
if let label {
480481
parameters["label"] = label
481482
}
482483

0 commit comments

Comments
 (0)