diff --git a/parser.go b/parser.go index 1bcc918..e0f8487 100644 --- a/parser.go +++ b/parser.go @@ -362,6 +362,10 @@ func decodeBase64(src, parent string) (string, error) { if !filepath.IsAbs(path) { path = filepath.Join(parent, path) } + if fi, err := os.Stat(path); os.IsNotExist(err) || fi.IsDir() { + // no image file found + return path, err + } f, err := os.Open(path) if err != nil { var pathErr *os.PathError @@ -414,10 +418,6 @@ func embedImage(src, parent string) (string, error) { color.Yellow("🙈 Embed Image Ignore [%d] %s", i+1, imgSrc) continue } - if f, e := os.Stat(imgSrc); os.IsNotExist(e) || f.IsDir() { - // no image file found - continue - } b64img, err := decodeBase64(imgSrc, parent) if err != nil {