From e5c5ecc379434b7ef4ffcbb9dcf58526cafda66a Mon Sep 17 00:00:00 2001 From: xuri Date: Mon, 26 Apr 2021 22:51:35 +0800 Subject: Fixed #825, improves compatibility for comments with absolute XML path --- comment.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'comment.go') diff --git a/comment.go b/comment.go index 3c48d61..705b957 100644 --- a/comment.go +++ b/comment.go @@ -39,7 +39,14 @@ func parseFormatCommentsSet(formatSet string) (*formatComment, error) { func (f *File) GetComments() (comments map[string][]Comment) { comments = map[string][]Comment{} for n, path := range f.sheetMap { - if d := f.commentsReader("xl" + strings.TrimPrefix(f.getSheetComments(filepath.Base(path)), "..")); d != nil { + target := f.getSheetComments(filepath.Base(path)) + if target == "" { + continue + } + if !filepath.IsAbs(target) { + target = "xl" + strings.TrimPrefix(target, "..") + } + if d := f.commentsReader(strings.TrimPrefix(target, "/")); d != nil { sheetComments := []Comment{} for _, comment := range d.CommentList.Comment { sheetComment := Comment{} -- cgit v1.2.1