Fix invalid await inside ?? autoclosure in BackupStatusService

Swift does not allow async expressions inside ?? closures.
Replaced with explicit if-let branch so await is at statement level.

Co-Authored-By: Kutesir <kutesir@provoc.ug>
Co-Authored-By: Sentry <sentry@provoc.ug>
This commit is contained in:
Robin Kutesa
2026-05-17 12:57:05 +03:00
parent 712e110f57
commit 2225629dd8

View File

@@ -111,12 +111,14 @@ final class BackupStatusService: NSObject, ObservableObject {
do { do {
let data = try await transfer.downloadData(at: manifestPath) let data = try await transfer.downloadData(at: manifestPath)
manifest = (try? JSONDecoder().decode(BackupManifest.self, from: data)) ?? { if let decoded = try? JSONDecoder().decode(BackupManifest.self, from: data) {
manifest = decoded
} else {
let items = (try? await transfer.listDirectory(at: conn.remotePath)) ?? [] let items = (try? await transfer.listDirectory(at: conn.remotePath)) ?? []
return BackupManifest.buildFromNASListing(items) manifest = BackupManifest.buildFromNASListing(items)
}() }
} catch { } catch {
// Manifest not found build from directory listing // Manifest not found bootstrap from directory listing
let items = (try? await transfer.listDirectory(at: conn.remotePath)) ?? [] let items = (try? await transfer.listDirectory(at: conn.remotePath)) ?? []
manifest = BackupManifest.buildFromNASListing(items) manifest = BackupManifest.buildFromNASListing(items)
} }