fix: use formatGNU tar
https://github.com/pterodactyl/panel/issues/4365
This commit is contained in:
parent
83861a6dec
commit
be8a7638c1
|
@ -8,6 +8,7 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"emperror.dev/errors"
|
||||
"github.com/apex/log"
|
||||
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user