This closes #1889, refs #1732 and #1735 (#1890)

Saving workbook with reverse sorted internal part path to keep same hash of identical files and fix incorrect MIME type
This commit is contained in:
barlevd 2024-04-30 19:05:05 +03:00 committed by GitHub
parent 7715c1462a
commit 781c38481d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -212,7 +212,7 @@ func (f *File) writeToZip(zw *zip.Writer) error {
files = append(files, path.(string)) files = append(files, path.(string))
return true return true
}) })
sort.Strings(files) sort.Sort(sort.Reverse(sort.StringSlice(files)))
for _, path := range files { for _, path := range files {
var fi io.Writer var fi io.Writer
if fi, err = zw.Create(path); err != nil { if fi, err = zw.Create(path); err != nil {
@ -228,7 +228,7 @@ func (f *File) writeToZip(zw *zip.Writer) error {
tempFiles = append(tempFiles, path.(string)) tempFiles = append(tempFiles, path.(string))
return true return true
}) })
sort.Strings(tempFiles) sort.Sort(sort.Reverse(sort.StringSlice(tempFiles)))
for _, path := range tempFiles { for _, path := range tempFiles {
var fi io.Writer var fi io.Writer
if fi, err = zw.Create(path); err != nil { if fi, err = zw.Create(path); err != nil {