fix not enough return

This commit is contained in:
Augists 2022-02-11 11:34:29 +08:00
parent 9bb4f5a5db
commit 2733498933

View File

@ -487,7 +487,7 @@ func findFile(files []*zip.File, target string) *zip.File {
func Docx2md(arg string, embed bool) (string, error) {
r, err := zip.OpenReader(arg)
if err != nil {
return err
return nil, err
}
defer r.Close()
@ -502,12 +502,12 @@ func Docx2md(arg string, embed bool) (string, error) {
b, _ := ioutil.ReadAll(rc)
if err != nil {
return err
return nil, err
}
err = xml.Unmarshal(b, &rels)
if err != nil {
return err
return nil, err
}
case "word/numbering.xml":
rc, err := f.Open()
@ -515,23 +515,23 @@ func Docx2md(arg string, embed bool) (string, error) {
b, _ := ioutil.ReadAll(rc)
if err != nil {
return err
return nil, err
}
err = xml.Unmarshal(b, &num)
if err != nil {
return err
return nil, err
}
}
}
f := findFile(r.File, "word/document*.xml")
if f == nil {
return errors.New("incorrect document")
return nil, errors.New("incorrect document")
}
node, err := readFile(f)
if err != nil {
return err
return nil, err
}
var buf bytes.Buffer