Skip to content

Commit

Permalink
Use actual prefix length
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbASF authored Feb 23, 2023
1 parent 382590a commit 7a7b8e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mail/fields/unstructured_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def fold(prepend = 0) # :nodoc:
encoding = normalized_encoding
encoding_overhead = "=?#{encoding}?Q??=".length
# The encoded string goes here ^ (between the ??)
max_safe_word = 78 - encoding_overhead - 10 # allow for encoding overhead + prefix
max_safe_word = 78 - encoding_overhead - prepend # allow for encoding overhead + prefix
decoded_string = decoded.to_s
words = decoded_string.split(/[ \t]/)
should_encode = !decoded_string.ascii_only? || words.any? {|word| word.length > max_safe_word}
Expand Down

0 comments on commit 7a7b8e7

Please sign in to comment.