IsValidURL checks if a URL is in valid format (basic structure validation)
(rawURL string)
| 76 | |
| 77 | // IsValidURL checks if a URL is in valid format (basic structure validation) |
| 78 | func IsValidURL(rawURL string) bool { |
| 79 | // Replace template variables with placeholders for parsing |
| 80 | testURL := replaceTemplateVariables(rawURL) |
| 81 | |
| 82 | // Parse the URL |
| 83 | u, err := url.Parse(testURL) |
| 84 | if err != nil { |
| 85 | return false |
| 86 | } |
| 87 | |
| 88 | // Check if scheme is present (http or https) |
| 89 | if u.Scheme != "http" && u.Scheme != "https" { |
| 90 | return false |
| 91 | } |
| 92 | |
| 93 | if u.Host == "" { |
| 94 | return false |
| 95 | } |
| 96 | return true |
| 97 | } |
| 98 | |
| 99 | // IsValidSubfolderPath checks if a subfolder path is valid |
| 100 | func IsValidSubfolderPath(path string) bool { |
no test coverage detected
searching dependent graphs…