Only guard remote fingerprint if local has any (#863)

Otherwise, it would never import remote profiles w/o a fingerprint.

Scenarios (must test in #570):

- No local profile → Import
- Local profile has no fingerprint → Import
- Local profile has fingerprint
  - Remote profile has no fingerprint → Skip
  - Remote profile has same fingerprint → Skip
  - Remote profile has different fingerprint → Import
This commit is contained in:
Davide 2024-11-13 21:46:14 +01:00 committed by GitHub
parent ecd2c1d45a
commit 91344c1294
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 3 deletions

View File

@ -440,10 +440,13 @@ private extension ProfileManager {
idsToRemove.append(remoteProfile.id) idsToRemove.append(remoteProfile.id)
continue continue
} }
guard remoteAttributes[remoteProfile.id]?.fingerprint != localAttributes[remoteProfile.id]?.fingerprint else { if let localFingerprint = localAttributes[remoteProfile.id]?.fingerprint {
guard let remoteFingerprint = remoteAttributes[remoteProfile.id]?.fingerprint,
remoteFingerprint != localFingerprint else {
pp_log(.App.profiles, .info, "Skip re-importing local profile \(remoteProfile.id)") pp_log(.App.profiles, .info, "Skip re-importing local profile \(remoteProfile.id)")
continue continue
} }
}
pp_log(.App.profiles, .notice, "Import remote profile \(remoteProfile.id)...") pp_log(.App.profiles, .notice, "Import remote profile \(remoteProfile.id)...")
try await save(remoteProfile) try await save(remoteProfile)
} catch { } catch {