Skip to content

Commit

Permalink
Handle userId correctly in File Provider Extension client interface
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
  • Loading branch information
claucambra authored and backportbot[bot] committed Oct 11, 2024
1 parent 5b472a2 commit 49f7b06
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,14 @@ extension FileProviderExtension: NSFileProviderServicing, ChangeNotificationInte
}
}

@objc func setupDomainAccount(user: String, serverUrl: String, password: String) {
@objc func setupDomainAccount(
user: String, userId: String, serverUrl: String, password: String
) {
let semaphore = DispatchSemaphore(value: 0)
var authAttemptState = AuthenticationAttemptResultState.connectionError // default
Task {
let authTestNcKit = NextcloudKit()
authTestNcKit.setup(user: user, userId: user, password: password, urlBase: serverUrl)
authTestNcKit.setup(user: user, userId: userId, password: password, urlBase: serverUrl)

// Retry a few times if we have a connection issue
for authTimeout in AuthenticationTimeouts {
Expand Down Expand Up @@ -146,13 +148,13 @@ extension FileProviderExtension: NSFileProviderServicing, ChangeNotificationInte
)
}

let newNcAccount = Account(user: user, serverUrl: serverUrl, password: password)
let newNcAccount = Account(user: user, id: userId, serverUrl: serverUrl, password: password)
guard newNcAccount != ncAccount else { return }
ncAccount = newNcAccount
ncKit.setup(
account: newNcAccount.ncKitAccount,
user: newNcAccount.username,
userId: newNcAccount.username,
userId: newNcAccount.id,
password: newNcAccount.password,
urlBase: newNcAccount.serverUrl,
userAgent: "Nextcloud-macOS/FileProviderExt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class FileProviderSocketLineProcessor: NSObject, LineProcessor {
let serverUrl = String(splitAccountDetails[2])
let password = String(splitAccountDetails[3])

delegate.setupDomainAccount(user: user, serverUrl: serverUrl, password: password)
delegate.setupDomainAccount(user: user, userId: userId, serverUrl: serverUrl, password: password)
}
}
}

0 comments on commit 49f7b06

Please sign in to comment.