Skip to content

fix: zip.Insert not saving permissions#35

Merged
mholt merged 1 commit intomholt:mainfrom
asdfzxcvbn:fix-permissions
Jun 12, 2025
Merged

fix: zip.Insert not saving permissions#35
mholt merged 1 commit intomholt:mainfrom
asdfzxcvbn:fix-permissions

Conversation

@asdfzxcvbn
Copy link
Contributor

just a simple change to fix permission bits not being saved on files being inserted into a zipfile. i'm using archives on a project of mine and noticed that all files being inserted have 0644 permissions, despite the files having 0755 perms. after a bit of digging, i found that the Append method being used does not save file permissions due to creating its own FileHeader. according to the docs for AppendHeader:

Writer takes ownership of fh and may mutate its fields. The caller must not modify fh after calling CreateHeader.

hdr is not being modified after calling AppendHeader, so this should really work just fine

@mholt
Copy link
Owner

mholt commented Jun 12, 2025

Thanks! Sorry for my delay getting to this. Have you tested that this does work for you?

@asdfzxcvbn
Copy link
Contributor Author

Thanks! Sorry for my delay getting to this. Have you tested that this does work for you?

yeah! it worked for me, but i've since switched to just using STARRY-S/zip directly

@mholt
Copy link
Owner

mholt commented Jun 12, 2025

Oh okay -- why's that?

(I'll probably still merge this since it seems to solve a problem.)

@mholt mholt merged commit 2706fb2 into mholt:main Jun 12, 2025
3 checks passed
@asdfzxcvbn
Copy link
Contributor Author

Oh okay -- why's that?

just to cut down on the dependencies needed. i was only working with zipfiles, and it was taking a while to get this pr merged, so i just decided to use it directly. thanks for merging, though!

@mholt
Copy link
Owner

mholt commented Jun 13, 2025

Gotcha, yeah that makes sense!

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.

2 participants