]> Cypherpunks repositories - gostls13.git/commit
archive/{zip,tar}: fix Writer.AddFS to include empty directories
authorSong Gao <song@gao.io>
Fri, 12 Apr 2024 08:18:29 +0000 (01:18 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 23 Sep 2024 14:32:33 +0000 (14:32 +0000)
commit0081f17f146140f5c02344bed16c530472fcdb0f
tree436135581a39b74ca6eee44597ce9ae10bfbff89
parent7678fe1e58e35084fd30ca11401f935bb94f0046
archive/{zip,tar}: fix Writer.AddFS to include empty directories

This change modifies the `(*Writer).AddFS` implementation in both `archive/zip`
and `archive/tar` to always write a directory header. This fixes a bug where
any empty directories in the fs were omitted when a zip or tar archive was
created from `AddFS` method.

Fixes #66831

Change-Id: Id32c9c747f9f65ec7db4aeefeaffa83567215bfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/578415
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
doc/next/6-stdlib/99-minor/archive/66831.md [new file with mode: 0644]
src/archive/tar/writer.go
src/archive/tar/writer_test.go
src/archive/zip/writer.go
src/archive/zip/writer_test.go