(content string)
| 1740 | } |
| 1741 | |
| 1742 | func extractImages(content string) []string { |
| 1743 | matches := extract.ExtractUrls(content) |
| 1744 | urls := map[string]bool{} |
| 1745 | for i := range matches { |
| 1746 | uRaw := matches[i].Text |
| 1747 | // Parse the extracted text so we can examine the path |
| 1748 | u, err := url.Parse(uRaw) |
| 1749 | if err != nil { |
| 1750 | continue |
| 1751 | } |
| 1752 | // Ensure the path looks like it leads to an image file |
| 1753 | if !imageURLRegex.MatchString(u.Path) { |
| 1754 | continue |
| 1755 | } |
| 1756 | urls[uRaw] = true |
| 1757 | } |
| 1758 | |
| 1759 | resURLs := make([]string, 0) |
| 1760 | for k := range urls { |
| 1761 | resURLs = append(resURLs, k) |
| 1762 | } |
| 1763 | return resURLs |
| 1764 | } |
no outgoing calls
no test coverage detected