(urlStr string, index int, itemType string)
| 31 | } |
| 32 | |
| 33 | func validateURL(urlStr string, index int, itemType string) error { |
| 34 | if !urlRegex.MatchString(urlStr) { |
| 35 | return fmt.Errorf("第%d个%s的URL格式不正确", index, itemType) |
| 36 | } |
| 37 | if _, err := url.Parse(urlStr); err != nil { |
| 38 | return fmt.Errorf("第%d个%s的URL无法解析:%s", index, itemType, err.Error()) |
| 39 | } |
| 40 | return nil |
| 41 | } |
| 42 | |
| 43 | func checkDangerousContent(content string, index int, itemType string) error { |
| 44 | lower := strings.ToLower(content) |
no test coverage detected