Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'config/initializers/mail_encoding_patch.rb')
-rw-r--r--config/initializers/mail_encoding_patch.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/config/initializers/mail_encoding_patch.rb b/config/initializers/mail_encoding_patch.rb
index 11a96625e08..f72d4814856 100644
--- a/config/initializers/mail_encoding_patch.rb
+++ b/config/initializers/mail_encoding_patch.rb
@@ -54,6 +54,13 @@ module Mail
decoded = dec.decode(raw_source)
if defined?(Encoding) && charset && charset != "US-ASCII"
+ # Sometimes, the decoded string is frozen. Encoders in
+ # Mail::Encodings behave differently in this case. Unlike the
+ # original implementation which does not modify this string, we
+ # enforce the encoding below. That may lead to FrozenError.
+ # Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/364619
+ decoded = decoded.dup if decoded.frozen?
+
# PATCH
# We need to force the encoding: in the case of quoted-printable
# this will throw an exception otherwise, because `decoded` will have