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

Wrap header values in quotes if they contain characters that are not allowed #190

Merged
merged 2 commits into from
Mar 18, 2025

Conversation

Awlexus
Copy link

@Awlexus Awlexus commented Mar 3, 2025

Changes proposed in this pull request

This PR adds quotes around header parameters if necessary. This resolves an issue where attachments with spaces in their file names would not be displayed correctly, due to the client thinking not parsing the rest of the name after the space

@bcardarella
Copy link
Member

Screenshot 2025-03-03 at 11 42 29 AM Not related to this issue but I don't think there needs to be this number of Elixir version checks

@@ -152,6 +153,14 @@ defmodule Mail.Renderers.RFC2822 do
defp render_subtypes([{key, value} | subtypes]) do
key = String.replace(key, "_", "-")
value = encode_header_value(value, :quoted_printable)

value =
if value =~ ~r/[\s;]/ do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should match all the tspecial characters of RFC2045
if Regex.match?(~r/[\s()<>@,;:\\<\/\[\]?=]/, value) do

@andrewtimberlake
Copy link
Collaborator

Not related to this issue but I don't think there needs to be this number of Elixir version checks

@bcardarella I’ve reduced the workflow to test on explicit Elixir/Erlang pairs instead of using a matrix to test all combinations

@andrewtimberlake andrewtimberlake merged commit 55fb0ae into DockYard:master Mar 18, 2025
5 checks passed
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.

3 participants