Skip to content

Conversation

@HosokawaR
Copy link

Fixes #453
This PR prevent #parse_buffer from altering input buffer.

As stated in the issue, it is more intuitive for parse_buffer to not change the input buffer.
However, the internal call Zip::File.open_buffer changes the input buffer if called with block.
Therefore, I changed the calling method so that it does not use block.

@weshatheleopard
Copy link
Owner

You see, I'm temped to NOT do anything about this issue in RubyXL since all that it does is passing the buffer to RubyZip; from that point, it's RubyZip responsebility: if it modifies buffer, it's it's fault, not RubyXLs. I do not appreciate this behavior, as there's no reason why it should ever modify the buffer, but that's what they do.
I figured out that when I pass a String to RubyZip, then .freeze'ing it before passing it over does the trick.
I don't have a problem adding a warning about that to the documentation. But I think RubyZip's issues need to be handled with its developers.

@HosokawaR
Copy link
Author

Thank you for your reply.

it's RubyZip responsebility:

I agree. This PR will be closed for now.

@HosokawaR HosokawaR closed this Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#parse_buffer unexpectedly modifies input buffer

2 participants