mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
FIX: Ruby 3 does not freeze interpolated string (#14567)
Ruby 2.7 or earlier `+contents` returns self.dup when `frozen_string_literal: true`. However, Ruby 3.0 returns self because this string is interpolated one, which is not frozen anymore. This commit uses self.dup to return duplicated string regardless Ruby versions. https://bugs.ruby-lang.org/issues/17104
This commit is contained in:
parent
837bd5a6e5
commit
2944d2cdd6
@ -34,7 +34,7 @@ class TopicEmbed < ActiveRecord::Base
|
||||
contents = first_paragraph_from(contents)
|
||||
end
|
||||
contents ||= ''
|
||||
contents = +contents << imported_from_html(url)
|
||||
contents = contents.dup << imported_from_html(url)
|
||||
|
||||
url = normalize_url(url)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user