From 781c38481dcd30fbd0bd3b43630e29dcdda7a3b3 Mon Sep 17 00:00:00 2001 From: barlevd <32372804+barlevd@users.noreply.github.com> Date: Tue, 30 Apr 2024 19:05:05 +0300 Subject: [PATCH] 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 --- file.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/file.go b/file.go index 067f999..03af61e 100644 --- a/file.go +++ b/file.go @@ -212,7 +212,7 @@ func (f *File) writeToZip(zw *zip.Writer) error { files = append(files, path.(string)) return true }) - sort.Strings(files) + sort.Sort(sort.Reverse(sort.StringSlice(files))) for _, path := range files { var fi io.Writer 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)) return true }) - sort.Strings(tempFiles) + sort.Sort(sort.Reverse(sort.StringSlice(tempFiles))) for _, path := range tempFiles { var fi io.Writer if fi, err = zw.Create(path); err != nil {