Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Sources/NextcloudKit/NKCommon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ public struct NKCommon: Sendable {
guard let groupDefaults = UserDefaults(suiteName: groupIdentifier) else {
return
}
let capabilities = NCCapabilities.shared.getCapabilitiesBlocking(for: account)

/// Unavailable
if errorCode == 503 {
Expand All @@ -429,7 +430,7 @@ public struct NKCommon: Sendable {
groupDefaults.set(array, forKey: NextcloudKit.shared.nkCommonInstance.groupDefaultsUnauthorized)
}
/// ToS
} else if errorCode == 403 {
} else if errorCode == 403, capabilities.termsOfService {
var array = groupDefaults.array(forKey: NextcloudKit.shared.nkCommonInstance.groupDefaultsToS) as? [String] ?? []

if !array.contains(account) {
Expand Down
4 changes: 2 additions & 2 deletions Sources/NextcloudKit/NextcloudKitBackground.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public final class NKBackground: NSObject, URLSessionTaskDelegate, URLSessionDel
var url: URL?
let groupDefaults = UserDefaults(suiteName: NextcloudKit.shared.nkCommonInstance.groupIdentifier)

/// Check error in groupDefaults
/// Check if error is in groupDefaults
if let array = groupDefaults?.array(forKey: NextcloudKit.shared.nkCommonInstance.groupDefaultsUnauthorized) as? [String],
array.contains(account) {
return (nil, .unauthorizedError)
Expand Down Expand Up @@ -77,7 +77,7 @@ public final class NKBackground: NSObject, URLSessionTaskDelegate, URLSessionDel
var uploadSession: URLSession?
let groupDefaults = UserDefaults(suiteName: NextcloudKit.shared.nkCommonInstance.groupIdentifier)

/// Check error in groupDefaults
/// Check if error is in groupDefaults
if let array = groupDefaults?.array(forKey: NextcloudKit.shared.nkCommonInstance.groupDefaultsUnauthorized) as? [String],
array.contains(account) {
return (nil, .unauthorizedError)
Expand Down
Loading