diff --git a/xlsx/sheets.go b/xlsx/sheets.go index fc9c76b..fa7b499 100644 --- a/xlsx/sheets.go +++ b/xlsx/sheets.go @@ -33,7 +33,7 @@ func (s *Sheet) parseSheet() error { linkmap := make(map[string]string) base := filepath.Base(s.docname) sub := strings.TrimSuffix(s.docname, base) - relsname := filepath.Join(sub, "_rels", base+".rels") + relsname := strings.ReplaceAll(filepath.Join(sub, "_rels", base+".rels"), "\\", "/") // fix the sep in zip file is still "/" but on windows is "\" dec, clo, err := s.d.openXML(relsname) if err == nil { // rels might not exist for every sheet diff --git a/xlsx/workbook.go b/xlsx/workbook.go index d789562..b8f33f7 100644 --- a/xlsx/workbook.go +++ b/xlsx/workbook.go @@ -32,7 +32,7 @@ func (d *Document) parseRels(dec *xml.Decoder, basedir string) error { // handle malformed "absolute" paths cleanly d.rels[vals["Type"]][vals["Id"]] = vals["Target"][1:] } else { - d.rels[vals["Type"]][vals["Id"]] = filepath.Join(basedir, vals["Target"]) + d.rels[vals["Type"]][vals["Id"]] = strings.ReplaceAll(filepath.Join(basedir, vals["Target"]), "\\", "/") // fix EOF in windows for sep being "\" instead of "/" } if vals["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" { d.primaryDoc = vals["Target"] diff --git a/xlsx/xlsx.go b/xlsx/xlsx.go index 3d5eaad..4a6ff3c 100644 --- a/xlsx/xlsx.go +++ b/xlsx/xlsx.go @@ -79,7 +79,7 @@ func Open(filename string) (grate.Source, error) { // parse the secondary relationships to primary doc base := filepath.Base(d.primaryDoc) sub := strings.TrimSuffix(d.primaryDoc, base) - relfn := filepath.Join(sub, "_rels", base+".rels") + relfn := strings.ReplaceAll(filepath.Join(sub, "_rels", base+".rels"), "\\", "/") // fix EOF in windows for sep being "\" instead of "/" dec, c, err = d.openXML(relfn) if err != nil { return nil, err