Skip to content

Commit

Permalink
don't write dump.xml on truncateSheetXMLValueOnly
Browse files Browse the repository at this point in the history
It looks like `dump.xml` are merely
dumping XML rows that are never read back.
As such it is unnecessary and might cause unexpected errors
when the program is called in
a read-only directory/FS
without serving any purpose.
  • Loading branch information
benedictjohannes committed Sep 9, 2023
1 parent c8a49a6 commit 3ff194b
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"path"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -1209,11 +1208,6 @@ func truncateSheetXMLValueOnly(r io.Reader) (io.Reader, error) {
// Delete all null value
var firstCell, lastCell []byte
sheetXML = rowRegexp.ReplaceAllFunc(sheetXML, func(rowMatch []byte) []byte {
err := ioutil.WriteFile("dump.xml", rowMatch, 0640)
if err != nil {
log.Fatalf("Failed to write (%s): %s", err, rowMatch)
}

if !valueRegexp.Match(rowMatch) {
rowMatch = rowRegexp.ReplaceAll(rowMatch, nil)
}
Expand Down

0 comments on commit 3ff194b

Please sign in to comment.