rubygem-wikicloth/rubygem-wikicloth-0.8.3-add-a-condition-to-avoid-FrozenError.patch
lyn1001 bf398184bd fix build error
(cherry picked from commit 1b1ea35ac9a50305bbfb9f0cdb846a556c50e05b)
2022-03-23 15:47:47 +08:00

28 lines
937 B
Diff

From 74f71ccf296c2b01e1a8455b4107b02316a7c7fb Mon Sep 17 00:00:00 2001
From: Peter Zhang <zpregister@gmail.com>
Date: Sat, 21 Mar 2020 00:38:14 +0100
Subject: add a condition to avoid FrozenError
nil.to_s in Ruby 2.7.0 now always return a frozen String ""
a=nil.to_s
a.gsub!(//,'')
will raise a FrozenError (can't modify frozen String: "")
---
lib/wikicloth/wiki_buffer/var.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/wikicloth/wiki_buffer/var.rb b/lib/wikicloth/wiki_buffer/var.rb
index 2e0f5d1..7a39527 100644
--- a/lib/wikicloth/wiki_buffer/var.rb
+++ b/lib/wikicloth/wiki_buffer/var.rb
@@ -80,7 +80,7 @@ def to_html
ret = @options[:link_handler].include_resource(key,key_options).to_s
- ret.gsub!(/<!--(.|\s)*?-->/,"")
+ ret.gsub!(/<!--(.|\s)*?-->/,"") unless ret.frozen?
count = 0
tag_attr = key_options.collect { |p|
if p.instance_of?(Hash)