Skip to content

Commit 1882acc

Browse files
pete-signalmax-signal
authored andcommitted
Handle missing CDN info better in the SVR🐝 restore path
1 parent 38f4c2f commit 1882acc

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

SignalServiceKit/Backups/Archiving/BackupArchiveManagerImpl.swift

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@ public class BackupArchiveManagerImpl: BackupArchiveManager {
286286
try await fetchRemoteSVR🐝ForwardSecrecyToken(key: key, auth: chatAuth)
287287
} catch SVR🐝Error.unrecoverable {
288288
// Not found, so consider a success and fallthrough
289+
Logger.info("SVR🐝 not found, skipping restore.")
290+
} catch {
291+
Logger.warn("Encountered error restoring SVR🐝: \(error)")
292+
throw error
289293
}
290294

291295
await db.awaitableWrite {
@@ -1562,10 +1566,16 @@ public class BackupArchiveManagerImpl: BackupArchiveManager {
15621566
chatServiceAuth: auth
15631567
)
15641568

1565-
let metadataHeader = try await backupCdnInfo(
1566-
backupKey: key,
1567-
backupAuth: backupServiceAuth
1568-
).metadataHeader
1569+
let metadataHeader: BackupNonce.MetadataHeader
1570+
do {
1571+
metadataHeader = try await backupCdnInfo(
1572+
backupKey: key,
1573+
backupAuth: backupServiceAuth
1574+
).metadataHeader
1575+
} catch let error as OWSHTTPError where error.responseStatusCode == 404 {
1576+
// If no backup is found, treat this as unrecoverable
1577+
throw SVR🐝Error.unrecoverable
1578+
}
15691579

15701580
let nonceSource = BackupImportSource.NonceMetadataSource.svr🐝(header: metadataHeader, auth: auth)
15711581
let source = BackupImportSource.remote(key: key, nonceSource: nonceSource)

0 commit comments

Comments
 (0)