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

Don't split Quoted Printable characters during folding procedure #22

Merged
merged 1 commit into from
Mar 21, 2018

Conversation

Gonzih
Copy link
Contributor

@Gonzih Gonzih commented Mar 17, 2018

I noticed that subjects sometimes are misformatted in my mail client due to improperly splitted quoted printable characters. Here is a small fix that should address this issue.

Thanks!

@codecov-io
Copy link

codecov-io commented Mar 17, 2018

Codecov Report

Merging #22 into master will increase coverage by 0.18%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #22      +/-   ##
==========================================
+ Coverage    88.2%   88.39%   +0.18%     
==========================================
  Files          13       13              
  Lines         373      379       +6     
==========================================
+ Hits          329      335       +6     
  Misses         25       25              
  Partials       19       19
Impacted Files Coverage Δ
header.go 94.59% <100%> (+0.47%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f7e2be8...6f9f764. Read the comment docs.

Copy link
Owner

@emersion emersion left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM. Adding a comment to explain a little the new code would be great, this function is a little tricky.

header.go Outdated
@@ -40,6 +41,8 @@ func formatHeaderField(k, v string) string {
return s + "\r\n"
}

qpReg := regexp.MustCompile("(=[0-9A-Z]{2,2})+")
Copy link
Owner

Choose a reason for hiding this comment

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

Can you move this outside the function, as a global variable?

@Gonzih
Copy link
Contributor Author

Gonzih commented Mar 20, 2018

Added comments, converted regexp in to a global var.

@emersion emersion merged commit 9b004c2 into emersion:master Mar 21, 2018
@emersion
Copy link
Owner

Thanks!

@Gonzih
Copy link
Contributor Author

Gonzih commented Mar 21, 2018

Cool, thanks. Only problem I just noticed with this change is that it insertes extra whitespace before QP character. Can this whitespace be ommited? I can submit another PR in case if I can just drop whitespace if folding step is gonna happen on QP regexp and not a whitespace.

@emersion
Copy link
Owner

Can this whitespace be ommited?

I don't think so, but let me know if you find a way to do that. The whitespace at the beginning of the line is used to mark folding.

@Gonzih
Copy link
Contributor Author

Gonzih commented Mar 22, 2018 via email

@emersion
Copy link
Owner

Yeah, that would be better.

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