Skip to content

Commit

Permalink
fix: use formatGNU tar
Browse files Browse the repository at this point in the history
  • Loading branch information
shugen002 committed Sep 8, 2022
1 parent 83861a6 commit be8a763
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions server/filesystem/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"path/filepath"
"strings"
"sync"
"time"

"emperror.dev/errors"
"github.com/apex/log"
Expand Down Expand Up @@ -183,6 +184,14 @@ func (a *Archive) addToArchive(p string, rp string, w *tar.Writer) error {

// Get the tar FileInfoHeader in order to add the file to the archive.
header, err := tar.FileInfoHeader(s, filepath.ToSlash(target))

// set to format gnu so 7-zip can read Chinese Filename
header.Format = tar.FormatGNU

// temp workaround for golang write accesstime and changetime into gnu_header‘s prefix.
header.AccessTime = time.Time{}
header.ChangeTime = time.Time{}

if err != nil {
return errors.WrapIff(err, "failed to get tar#FileInfoHeader for '%s'", rp)
}
Expand Down

0 comments on commit be8a763

Please sign in to comment.