Skip to content

chore(coderd): improve tests for tar<->zip conversion #12477

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

Merged
merged 5 commits into from
Mar 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(coderd): set mode and modtime correctly when converting from zip …
…to tar (#12476)

* fix(coderd): set mode and modtime correctly when converting from zip->tar
  • Loading branch information
johnstcn authored Mar 11, 2024
commit ad47dc965096dd5d37333cd324bd5b32d311f92c
10 changes: 7 additions & 3 deletions coderd/fileszip.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ func processFileInZipArchive(file *zip.File, tarWriter *tar.Writer) error {
defer fileReader.Close()

err = tarWriter.WriteHeader(&tar.Header{
Name: file.Name,
Size: file.FileInfo().Size(),
Mode: 0o644,
Name: file.Name,
Size: file.FileInfo().Size(),
Mode: int64(file.Mode()),
ModTime: file.Modified,
// Note: Zip archives do not store ownership information.
Uid: 1000,
Gid: 1000,
})
if err != nil {
return err
Expand Down