MCPcopy
hub / github.com/1Password/for-open-source / ParseAccountURL

Function ParseAccountURL

script/validator.go:99–113  ·  view source on GitHub ↗
(value string)

Source from the content-addressed store, hash-verified

97}
98
99func ParseAccountURL(value string) (bool, string, string) {
100 if !accountURLRegex.Match([]byte(value)) {
101 return false, value, "is invalid 1Password account URL"
102 }
103 if !strings.HasPrefix(value, "http://") && !strings.HasPrefix(value, "https://") {
104 value = "https://" + value
105 }
106
107 u, err := url.Parse(value)
108 if err != nil {
109 return false, value, err.Error()
110 }
111
112 return true, u.Hostname(), ""
113}
114
115func ParseCheckbox(value string) (bool, string, string) {
116 value = strings.TrimLeft(strings.ToLower(value), "- ")

Callers

nothing calls this directly

Calls 2

ParseMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected