Skip to content

Commit bf4d890

Browse files
committed
fix: Log only account identifier instead of the whole struct.
Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
1 parent 3c28f9c commit bf4d890

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

Sources/NextcloudFileProviderKit/Log/FileProviderLogDetail.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ public enum FileProviderLogDetail: Encodable {
9090
if let someValue = anyOptional {
9191
if someValue.self is String {
9292
self = .string(someValue as! String)
93+
} else if let account = someValue as? Account {
94+
self = .string(account.ncKitAccount)
9395
} else if let error = someValue as? NSFileProviderError {
9496
self = .string("NSFileProviderError.Code: \(error.code)")
9597
} else if let error = someValue as? NSError {

Sources/NextcloudFileProviderKit/Utilities/Account.swift

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,23 @@ let AccountDictTrashUrlKey = "trashUrlKey"
1313
let AccountDictTrashRestoreUrlKey = "trashRestoreUrlKey"
1414
let AccountDictFileNameKey = "fileNameKey"
1515

16-
public struct Account: Equatable, Sendable {
16+
public struct Account: CustomStringConvertible, Equatable, Sendable {
1717
public static let webDavFilesUrlSuffix = "/remote.php/dav/files/"
1818
public static let webDavTrashUrlSuffix = "/remote.php/dav/trashbin/"
19-
public let username,
20-
id,
21-
password,
22-
ncKitAccount,
23-
serverUrl,
24-
davFilesUrl,
25-
trashUrl,
26-
trashRestoreUrl,
27-
fileName: String
19+
20+
public let username: String
21+
public let id: String
22+
public let password: String
23+
public let ncKitAccount: String
24+
public let serverUrl: String
25+
public let davFilesUrl: String
26+
public let trashUrl: String
27+
public let trashRestoreUrl: String
28+
public let fileName: String
29+
30+
public var description: String {
31+
ncKitAccount // Custom textual representation to avoid password leakage.
32+
}
2833

2934
public static func ncKitAccountString(from username: String, serverUrl: String) -> String {
3035
username + " " + serverUrl
@@ -83,4 +88,3 @@ public struct Account: Equatable, Sendable {
8388
]
8489
}
8590
}
86-

0 commit comments

Comments
 (0)