Skip to content

Commit

Permalink
chore: Make sure no files are missed (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnetop authored Nov 12, 2023
1 parent 45be6f5 commit 7f06df7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions internal/sn/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ func convertNotesnookToStandardNotes(nooks []notesnook.Nook) StandardNotes {
}
}

const matchHTMLTags = "img,span"
const (
fileAttributeName = "data-filename"
matchHTMLTags = "*[" + fileAttributeName + "]"
)

func mapNookNoteToStandardNote(
nook notesnook.Nook,
Expand All @@ -95,8 +98,10 @@ func mapNookNoteToStandardNote(
}

doc.Find(matchHTMLTags).Each(func(i int, s *goquery.Selection) {
dataFilename, _ := s.Attr("data-filename")
s.ReplaceWithHtml(fileUtil.ConvertFileToBase64(dataFilename))
dataFilename, hasAttr := s.Attr(fileAttributeName)
if hasAttr {
s.ReplaceWithHtml(fileUtil.ConvertFileToBase64(dataFilename))
}
})

html, err := doc.Html()
Expand Down

0 comments on commit 7f06df7

Please sign in to comment.