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:
@@ -111,12 +111,14 @@ final class BackupStatusService: NSObject, ObservableObject {
|
||||
|
||||
do {
|
||||
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)) ?? []
|
||||
return BackupManifest.buildFromNASListing(items)
|
||||
}()
|
||||
manifest = BackupManifest.buildFromNASListing(items)
|
||||
}
|
||||
} catch {
|
||||
// Manifest not found — build from directory listing
|
||||
// Manifest not found — bootstrap from directory listing
|
||||
let items = (try? await transfer.listDirectory(at: conn.remotePath)) ?? []
|
||||
manifest = BackupManifest.buildFromNASListing(items)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user