diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-10 14:52:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-10 14:52:44 +0000 |
commit | 86a8eee1b8bd43a1fe962905eb97a1f478cc050b (patch) | |
tree | 439816bbaf4a0caf16d579223eb9465e0b0daebc /lib/gitlab/middleware | |
parent | 1b517a5a19c4aafc6fa6d738b0ee7c1e4a2cce36 (diff) | |
download | gitlab-ce-86a8eee1b8bd43a1fe962905eb97a1f478cc050b.tar.gz |
Add latest changes from gitlab-org/gitlab@13-6-stable-ee
Diffstat (limited to 'lib/gitlab/middleware')
-rw-r--r-- | lib/gitlab/middleware/handle_malformed_strings.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/gitlab/middleware/handle_malformed_strings.rb b/lib/gitlab/middleware/handle_malformed_strings.rb index 84f7e2e1b14..b966395ee32 100644 --- a/lib/gitlab/middleware/handle_malformed_strings.rb +++ b/lib/gitlab/middleware/handle_malformed_strings.rb @@ -93,7 +93,8 @@ module Gitlab # We try to encode the string from ASCII-8BIT to UTF8. If we failed to do # so for certain characters in the string, those chars are probably incomplete # multibyte characters. - string.encode(Encoding::UTF_8).match?(NULL_BYTE_REGEX) + string.dup.force_encoding(Encoding::UTF_8).match?(NULL_BYTE_REGEX) + rescue ArgumentError, Encoding::UndefinedConversionError # If we're here, we caught a malformed string. Return true true |