mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-06-28 15:45:35 +08:00
fix not enough return
This commit is contained in:
parent
9bb4f5a5db
commit
2733498933
@ -487,7 +487,7 @@ func findFile(files []*zip.File, target string) *zip.File {
|
|||||||
func Docx2md(arg string, embed bool) (string, error) {
|
func Docx2md(arg string, embed bool) (string, error) {
|
||||||
r, err := zip.OpenReader(arg)
|
r, err := zip.OpenReader(arg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer r.Close()
|
defer r.Close()
|
||||||
|
|
||||||
@ -502,12 +502,12 @@ func Docx2md(arg string, embed bool) (string, error) {
|
|||||||
|
|
||||||
b, _ := ioutil.ReadAll(rc)
|
b, _ := ioutil.ReadAll(rc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = xml.Unmarshal(b, &rels)
|
err = xml.Unmarshal(b, &rels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
case "word/numbering.xml":
|
case "word/numbering.xml":
|
||||||
rc, err := f.Open()
|
rc, err := f.Open()
|
||||||
@ -515,23 +515,23 @@ func Docx2md(arg string, embed bool) (string, error) {
|
|||||||
|
|
||||||
b, _ := ioutil.ReadAll(rc)
|
b, _ := ioutil.ReadAll(rc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = xml.Unmarshal(b, &num)
|
err = xml.Unmarshal(b, &num)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f := findFile(r.File, "word/document*.xml")
|
f := findFile(r.File, "word/document*.xml")
|
||||||
if f == nil {
|
if f == nil {
|
||||||
return errors.New("incorrect document")
|
return nil, errors.New("incorrect document")
|
||||||
}
|
}
|
||||||
node, err := readFile(f)
|
node, err := readFile(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
Loading…
Reference in New Issue
Block a user