Skip to content

Commit

Permalink
fix: Add a guard to secure file
Browse files Browse the repository at this point in the history
  • Loading branch information
lebojo committed Oct 31, 2024
1 parent 89df788 commit 2c76c8a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Mail/Views/Bottom sheets/ReportDisplayProblemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ struct ReportDisplayProblemView: View {
await tryOrDisplayError {
// Download message
let fileURL = try await mailboxManager.apiFetcher.download(messages: [message])
guard let firstFileURL = fileURL.first else { throw MailError.unknownError }
// Send it via Sentry
let fileAttachment = Attachment(path: fileURL.first!.path,
filename: fileURL.first!.lastPathComponent,
let fileAttachment = Attachment(path: firstFileURL.path,
filename: firstFileURL.lastPathComponent,
contentType: "message/rfc822")
_ = SentrySDK.capture(message: "Message display problem reported") { scope in
scope.addAttachment(fileAttachment)
Expand Down

0 comments on commit 2c76c8a

Please sign in to comment.