Skip to content

fix: extended timestamp in central header refers to the local header - #1310

Merged
Pr0methean merged 2 commits into
masterfrom
fix-entended-timestamp-central
Nov 16, 2026
Merged

Pr0methean merged 2 commits into
masterfrom
fix-entended-timestamp-central

Conversation

@Its-Just-Nans

@Its-Just-Nans Its-Just-Nans commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

This PR correctly fixes the extended timestamp handling in the central directory header to conform with the ZIP specification. Per the spec, the flags byte in the central directory's extended timestamp field describes what the local header contains — it is not a description of the central header's own data. The old code incorrectly masked off the Accessed and Created flag bits when writing a central header, so a reader following the spec would incorrectly infer that the local header had no access or creation timestamps.

The corresponding test assertion update (changing 0b0000_0001 → 0b0000_0111) is consistent with this fix.

One minor issue (not blocking): The comment // in the central header at line 408 of test_extended_timestamp is a pre-existing mislabeling — the call on line 410 passes is_local_header: true, so it is actually testing the local header path. Since a new, properly-named test_extended_timestamp_in_central_header test was added in this PR, the misleading comment in the existing test becomes more visible and should be corrected to avoid confusion for future contributors. This is not a logic error and does not block the merge.

The logic change itself is correct and no blocking defects were found.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Pr0methean
Pr0methean previously approved these changes Nov 16, 2026
@Its-Just-Nans

Copy link
Copy Markdown
Member Author

wait I need to correct the comment.

From amazon review

@Pr0methean
Pr0methean enabled auto-merge November 16, 2026 14:29
@Pr0methean
Pr0methean added this pull request to the merge queue Nov 16, 2026
Merged via the queue into master with commit 1ba9569 Nov 16, 2026
122 of 125 checks passed
@Pr0methean
Pr0methean deleted the fix-entended-timestamp-central branch November 16, 2026 15:49
@ByGh00st

Copy link
Copy Markdown
Contributor

Thanks for catching this and opening the fix, @Its-Just-Nans! The change matches extrafld.txt (central header Flags refers to the local header) and keeps raw_copy_file consistent as well.

Two tiny cleanup notes while you're touching src/extra_fields/extended_timestamp.rs:

  1. The comment inside ExtendedTimestamp::write ("and flags that don't match the data would make the field unreadable") and the doc comment above test_write_central_header ("so its flags must not advertise the access and creation times") still reflect the old behavior and could be updated to say the central header flags mirror the local header.
  2. As a separate follow-up note (no need to block fix: extended timestamp in central header refers to the local header #1310 on it), ExtendedFileOptions::add_extended_timestamp currently stores the is_local_header = true bytes inside a CustomExtraField, so entries created via with_extended_timestamp still write all timestamps in the central header too -- which your new 13-byte test case in test_extended_timestamp_in_central_header confirms the reader handles fine.

LGTM!

@Its-Just-Nans

Copy link
Copy Markdown
Member Author

I will make a new PR for the comments

Thanks for the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants