Skip to content

Commit

Permalink
Don't fail TSAttachment migration on quoted reply validation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
harry-signal committed Dec 12, 2024
1 parent eb9392b commit 4f35c69
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 139 deletions.
6 changes: 3 additions & 3 deletions SignalServiceKit/Storage/Database/GRDBSchemaMigrator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3710,17 +3710,17 @@ public class GRDBSchemaMigrator: NSObject {
}

migrator.registerMigration(.tsMessageAttachmentMigration1) { tx in
try TSAttachmentMigration.TSMessageMigration.prepareBlockingTSMessageMigration(tx: tx)
TSAttachmentMigration.TSMessageMigration.prepareBlockingTSMessageMigration(tx: tx)
return .success(())
}

migrator.registerMigration(.tsMessageAttachmentMigration2) { tx in
try TSAttachmentMigration.TSMessageMigration.completeBlockingTSMessageMigration(tx: tx)
TSAttachmentMigration.TSMessageMigration.completeBlockingTSMessageMigration(tx: tx)
return .success(())
}

migrator.registerMigration(.tsMessageAttachmentMigration3) { tx in
try TSAttachmentMigration.TSMessageMigration.cleanUpTSAttachmentFiles()
TSAttachmentMigration.TSMessageMigration.cleanUpTSAttachmentFiles()
try tx.database.drop(table: "TSAttachmentMigration")
return .success(())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ extension TSAttachmentMigration {
self.reservedV2AttachmentVideoStillFrameFileId = reservedV2AttachmentVideoStillFrameFileId
}

func cleanUpFiles() throws {
func cleanUpFiles() {
for uuid in [
self.reservedV2AttachmentPrimaryFileId,
self.reservedV2AttachmentAudioWaveformFileId,
Expand All @@ -203,7 +203,11 @@ extension TSAttachmentMigration {
let fileUrl = TSAttachmentMigration.V2Attachment.absoluteAttachmentFileURL(
relativeFilePath: relPath
)
try OWSFileSystem.deleteFileIfExists(url: fileUrl)
do {
try OWSFileSystem.deleteFileIfExists(url: fileUrl)
} catch {
owsFail("Unable to clean up reserved files")
}
}
}
}
Expand Down
Loading

0 comments on commit 4f35c69

Please sign in to comment.