Skip to content

Copy file stats to archive entry - #1086

Merged
alex-dev-neo merged 2 commits into
masterfrom
zip_files_incorrect_creation_date
Jul 28, 2026
Merged

Copy file stats to archive entry#1086
alex-dev-neo merged 2 commits into
masterfrom
zip_files_incorrect_creation_date

Conversation

@vitaliy-sova-ios

Copy link
Copy Markdown
Contributor

Add archive_entry_copy_stat() call to ensure file metadata (permissions, timestamps, ownership) is properly preserved when creating archive entries. This fixes incomplete file metadata in archives.

Add archive_entry_copy_stat() call to ensure file metadata (permissions, timestamps, ownership) is properly preserved when creating archive entries. This fixes incomplete file metadata in archives.
Comment thread src/ArchiveWriter_P.cpp Outdated
stat(filename, &st);
entry = archive_entry_new();
auto fileNameReplacedArray = fileName.replace(basePath + QStringLiteral("/"), QStringLiteral("")).toUtf8();
archive_entry_copy_stat(entry, &st);

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.

If the goal of this PR is only to fix the file timestamp in the ZIP archive, it would be better to set it explicitly with archive_entry_set_mtime(entry, st.st_mtime, 0); rather than copying the entire stat structure.

Replace archive_entry_copy_stat() with archive_entry_set_mtime() to preserve only the modification time instead of copying all stat metadata. This ensures consistent behavior and avoids potential platform-specific stat field issues when writing archive entries.
@alex-dev-neo
alex-dev-neo merged commit 577a2c2 into master Jul 28, 2026
@alex-dev-neo
alex-dev-neo deleted the zip_files_incorrect_creation_date branch July 28, 2026 07:28
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.

3 participants