-
Notifications
You must be signed in to change notification settings - Fork 689
Open
Labels
Done in caxlsxThis has already been solved in the caxlsx fork.This has already been solved in the caxlsx fork.
Description
My rails project, which is running with RUBYOPT="--enable-frozen-string-literal", encounter this problem.
The Error message is:
Failure/Error: package.serialize(tempfile)
FrozenError:
can't modify frozen String: ""
# /home/khiav/.rvm/gems/ruby-3.0.0/gems/axlsx-2.0.1/lib/axlsx/rels/relationships.rb:23:in `to_xml_string'
# /home/khiav/.rvm/gems/ruby-3.0.0/gems/axlsx-2.0.1/lib/axlsx/package.rb:197:in `parts'
# /home/khiav/.rvm/gems/ruby-3.0.0/gems/axlsx-2.0.1/lib/axlsx/package.rb:160:in `write_parts'
# /home/khiav/.rvm/gems/ruby-3.0.0/gems/axlsx-2.0.1/lib/axlsx/package.rb:105:in `block in serialize'
# /home/khiav/.rvm/gems/ruby-3.0.0/gems/rubyzip-1.0.0/lib/zip/output_stream.rb:49:in `open'
# /home/khiav/.rvm/gems/ruby-3.0.0/gems/axlsx-2.0.1/lib/axlsx/package.rb:104:in `serialize'
It looks like the default arguments of to_xml_string method is a frozen string when running with the flag.
axlsx/lib/axlsx/rels/relationships.rb
Line 24 in 83e2398
| def to_xml_string(str = '') |
I suggest we replace '' with String.new, so that the empty string will never be frozen.
Metadata
Metadata
Assignees
Labels
Done in caxlsxThis has already been solved in the caxlsx fork.This has already been solved in the caxlsx fork.