-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't set time with get_output_stream #503
Comments
Hi @u3shit, thanks for reporting this. I think I see what's going wrong here: presumably the type mismatch between I can see a way to a fix though, so I'll get this sorted as soon as I can. |
When passing an `Entry` type to `File#get_output_stream` the entry is used to create a `StreamableStream`, which preserves all the info in the entry, such as timestamp, etc. But then in `put_next_entry` all that is lost due to the test for `kind_of?(Entry)` which a `StreamableStream` is not. See rubyzip#503 for details. This change tests for `StreamableStream`s in `put_next_entry` and uses them directly. Some set-up within `Entry` needed to be made more robust to cope with this, but otherwise it's a low impact change, which does fix the problem. The reason this case was being missed before is that the tests weren't testing `get_output_stream` with an `Entry` object, so I have also added that test too. Fixes rubyzip#503.
When passing an `Entry` type to `File#get_output_stream` the entry is used to create a `StreamableStream`, which preserves all the info in the entry, such as timestamp, etc. But then in `put_next_entry` all that is lost due to the test for `kind_of?(Entry)` which a `StreamableStream` is not. See rubyzip#503 for details. This change tests for `StreamableStream`s in `put_next_entry` and uses them directly. Some set-up within `Entry` needed to be made more robust to cope with this, but otherwise it's a low impact change, which does fix the problem. The reason this case was being missed before is that the tests weren't testing `get_output_stream` with an `Entry` object, so I have also added that test too. Fixes rubyzip#503.
Thanks, it looks like it's working with my code (after I fixed the 3.0 api break with optional parameters, uh-oh. But at least it looks like I don't even have to construct an |
Thanks for checking! ⚡ I am a bit nervous about the API changes, but hopefully people will see the benefits of the more modern style. As you say - not so many |
When passing an `Entry` type to `File#get_output_stream` the entry is used to create a `StreamableStream`, which preserves all the info in the entry, such as timestamp, etc. But then in `put_next_entry` all that is lost due to the test for `kind_of?(Entry)` which a `StreamableStream` is not. See rubyzip#503 for details. This change tests for `StreamableStream`s in `put_next_entry` and uses them directly. Some set-up within `Entry` needed to be made more robust to cope with this, but otherwise it's a low impact change, which does fix the problem. The reason this case was being missed before is that the tests weren't testing `get_output_stream` with an `Entry` object, so I have also added that test too. Fixes rubyzip#503.
When passing an `Entry` type to `File#get_output_stream` the entry is used to create a `StreamableStream`, which preserves all the info in the entry, such as timestamp, etc. But then in `put_next_entry` all that is lost due to the test for `kind_of?(Entry)` which a `StreamableStream` is not. See rubyzip#503 for details. This change tests for `StreamableStream`s in `put_next_entry` and uses them directly. Some set-up within `Entry` needed to be made more robust to cope with this, but otherwise it's a low impact change, which does fix the problem. The reason this case was being missed before is that the tests weren't testing `get_output_stream` with an `Entry` object, so I have also added that test too. Fixes rubyzip#503.
When passing an `Entry` type to `File#get_output_stream` the entry is used to create a `StreamableStream`, which preserves all the info in the entry, such as timestamp, etc. But then in `put_next_entry` all that is lost due to the test for `kind_of?(Entry)` which a `StreamableStream` is not. See rubyzip#503 for details. This change tests for `StreamableStream`s in `put_next_entry` and uses them directly. Some set-up within `Entry` needed to be made more robust to cope with this, but otherwise it's a low impact change, which does fix the problem. The reason this case was being missed before is that the tests weren't testing `get_output_stream` with an `Entry` object, so I have also added that test too. Fixes rubyzip#503.
When passing an `Entry` type to `File#get_output_stream` the entry is used to create a `StreamableStream`, which preserves all the info in the entry, such as timestamp, etc. But then in `put_next_entry` all that is lost due to the test for `kind_of?(Entry)` which a `StreamableStream` is not. See rubyzip#503 for details. This change tests for `StreamableStream`s in `put_next_entry` and uses them directly. Some set-up within `Entry` needed to be made more robust to cope with this, but otherwise it's a low impact change, which does fix the problem. The reason this case was being missed before is that the tests weren't testing `get_output_stream` with an `Entry` object, so I have also added that test too. Fixes rubyzip#503.
When passing an `Entry` type to `File#get_output_stream` the entry is used to create a `StreamableStream`, which preserves all the info in the entry, such as timestamp, etc. But then in `put_next_entry` all that is lost due to the test for `kind_of?(Entry)` which a `StreamableStream` is not. See rubyzip#503 for details. This change tests for `StreamableStream`s in `put_next_entry` and uses them directly. Some set-up within `Entry` needed to be made more robust to cope with this, but otherwise it's a low impact change, which does fix the problem. The reason this case was being missed before is that the tests weren't testing `get_output_stream` with an `Entry` object, so I have also added that test too. Fixes rubyzip#503.
When passing an `Entry` type to `File#get_output_stream` the entry is used to create a `StreamableStream`, which preserves all the info in the entry, such as timestamp, etc. But then in `put_next_entry` all that is lost due to the test for `kind_of?(Entry)` which a `StreamableStream` is not. See rubyzip#503 for details. This change tests for `StreamableStream`s in `put_next_entry` and uses them directly. Some set-up within `Entry` needed to be made more robust to cope with this, but otherwise it's a low impact change, which does fix the problem. The reason this case was being missed before is that the tests weren't testing `get_output_stream` with an `Entry` object, so I have also added that test too. Fixes rubyzip#503.
When passing an `Entry` type to `File#get_output_stream` the entry is used to create a `StreamableStream`, which preserves all the info in the entry, such as timestamp, etc. But then in `put_next_entry` all that is lost due to the test for `kind_of?(Entry)` which a `StreamableStream` is not. See rubyzip#503 for details. This change tests for `StreamableStream`s in `put_next_entry` and uses them directly. Some set-up within `Entry` needed to be made more robust to cope with this, but otherwise it's a low impact change, which does fix the problem. The reason this case was being missed before is that the tests weren't testing `get_output_stream` with an `Entry` object, so I have also added that test too. Fixes rubyzip#503.
When passing an `Entry` type to `File#get_output_stream` the entry is used to create a `StreamableStream`, which preserves all the info in the entry, such as timestamp, etc. But then in `put_next_entry` all that is lost due to the test for `kind_of?(Entry)` which a `StreamableStream` is not. See rubyzip#503 for details. This change tests for `StreamableStream`s in `put_next_entry` and uses them directly. Some set-up within `Entry` needed to be made more robust to cope with this, but otherwise it's a low impact change, which does fix the problem. The reason this case was being missed before is that the tests weren't testing `get_output_stream` with an `Entry` object, so I have also added that test too. Fixes rubyzip#503.
When passing an `Entry` type to `File#get_output_stream` the entry is used to create a `StreamableStream`, which preserves all the info in the entry, such as timestamp, etc. But then in `put_next_entry` all that is lost due to the test for `kind_of?(Entry)` which a `StreamableStream` is not. See #503 for details. This change tests for `StreamableStream`s in `put_next_entry` and uses them directly. Some set-up within `Entry` needed to be made more robust to cope with this, but otherwise it's a low impact change, which does fix the problem. The reason this case was being missed before is that the tests weren't testing `get_output_stream` with an `Entry` object, so I have also added that test too. Fixes #503.
I'm trying to put an entry with some arbitrary timestamp into the zip file, but it doesn't work, it always writes
Time.now
:But unzip reports the current date:
It looks like
File#get_output_stream
adds aStreamableStream
to@entry_set
, but later inOutputStream#put_next_entry
it checksentry_name.kind_of?(Entry)
, which will be false and it creates a newEntry
ignoring everything I've set up in the entry. The same happens if I don't create the entry manually but pass the time to#get_output_stream
.File#add
works correctly, but it requires creating a temporary file and manually setting the last modification date on it.Using ruby 3.0.2p107 and rubyzip 2.3.2.
The text was updated successfully, but these errors were encountered: