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:
parent
7715c1462a
commit
781c38481d
4
file.go
4
file.go
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue