Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE-41] Bugfix: Parsing text/plain and text/html attachments #44

Merged
merged 2 commits into from
Aug 13, 2023

Conversation

mnako
Copy link
Owner

@mnako mnako commented Aug 13, 2023

Rationale

As reported by @naidishuli in #41, we have been parsing text/plain and text/html attachments incorrectly. Even when they are attached with the Content-Disposition: attachment header, we mistakenly treat them as text and HTML content, respectively.

This PR addresses and resolves this problem.

Commits:

  1. baed02e: Add tests reproducing the reported issue. Tests should fail on this commit:
    • Modify multipart/mixed test files to include a text/plain and a text/html content-disposition: attachment files.
    • Modify letters_test.go to expect text/plain and text/html attachments to be correctly parsed.
  2. 13b2791: implement fix:
    • Modify parsers.go to parse Content Disposition header in parsePart() to correctly handle attachments of any content type.
    • Simplify parsePart() loop.
    • Simplify isInlineFile() and isAttachedFile() to not parse Content Disposition header multiple times.

mnako added 2 commits August 13, 2023 10:30
…a text/plain and a text/html content-disposition: attachment files.

Modify letters_test.go to expect text/plain and text/html attachments to be correctly parsed.
…arsePart() to correctly handle attachments of any content type.

Simplify parsePart() loop.
Simplify isInlineFile() and isAttachedFile() to not parse Content Disposition header multiple times.
@mnako mnako marked this pull request as ready for review August 13, 2023 05:47
@mnako mnako changed the title [WIP] [ISSUE-41] Bugfix: Parsing text/plain and text/html attachments [ISSUE-41] Bugfix: Parsing text/plain and text/html attachments Aug 13, 2023
@mnako mnako merged commit 77a9c69 into main Aug 13, 2023
@mnako mnako deleted the bugfix/41/plain-html-attachments branch August 13, 2023 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant