Skip to content

Commit

Permalink
fix: better detection of multipart encrypted email
Browse files Browse the repository at this point in the history
  • Loading branch information
ioanmo226 committed Nov 13, 2024
1 parent 5be5b9a commit ff3e520
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private extension GTLRGmail_Message {
}

var attachmentParts: [GTLRGmail_MessagePart] {
payload?.parts?.filter { !$0.filename.isEmptyOrNil } ?? []
payload?.parts ?? []
}

func parseMessageBody() -> MessageBody {
Expand Down Expand Up @@ -148,12 +148,12 @@ private extension GTLRGmail_Message {

func parseAttachments() -> [MessageAttachment] {
attachmentParts.compactMap {
guard let body = $0.body, let id = body.attachmentId, let name = $0.filename
guard let body = $0.body, let id = body.attachmentId
else { return nil }

return MessageAttachment(
id: Identifier(stringId: id),
name: name,
name: $0.filename ?? "noname",
estimatedSize: body.size?.intValue,
mimeType: $0.mimeType,
data: body.data?.data()
Expand Down

0 comments on commit ff3e520

Please sign in to comment.