Skip to content

SendGridMessage.AddAttachmentAsync does not fully read the stream #1219

@FroshKiller

Description

@FroshKiller

AddAttachmentAsync calls Stream.ReadAsync once with the assumption that the stream is read from beginning to end in one call, but that is not guaranteed. The correct pattern is to inspect the return value, which is the number of bytes read in the operation, and continue reading to the end of the stream. This results in mangled attachments when the stream is not fully read in one call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions