Using correct regexp function

I knew FindAll was too simple
main
Nick Dumas 2 years ago
parent 3c82c4da63
commit 70e9a934af

@ -142,8 +142,8 @@ func extractAttachments(post string, l *zap.Logger) ([]string, error) {
return attachments, fmt.Errorf("error opening post to scan for attachment links: %q", err) return attachments, fmt.Errorf("error opening post to scan for attachment links: %q", err)
} }
for _, att := range pat.FindAll(postBody, -1) { for _, att := range pat.FindAllSubmatch(postBody, -1) {
l.Info("found attachment", zap.String("filename", string(att))) l.Info("found attachment", zap.String("filename", string(att[1])))
} }

Loading…
Cancel
Save