package hearthbounty import "strings" func asciiLowerByte(c byte) byte { if c >= 'A' && c <= 'Z' { return c + ('a' - 'A') } return c } func hasASCIIPrefixFold(s string, pos int, pattern string) bool { if pos+len(pattern) > len(s) { return false } for j := 0; j < len(pattern); j++ { if asciiLowerByte(s[pos+j]) != pattern[j] { return false } } return true } // NeutralizeGnoTags escapes any "i\u0307") // from shifting slice indices and letting raw tags pass through. func NeutralizeGnoTags(s string) string { var b strings.Builder changed := false for i := 0; i < len(s); i++ { if s[i] == '<' && (hasASCIIPrefixFold(s, i, " 300 { panic("hearthbounty: proof URL exceeds maximum length") } if !strings.HasPrefix(trimmed, "https://") { panic("hearthbounty: proof URL must start with https://") } if strings.ContainsAny(trimmed, " \t\r\n") { panic("hearthbounty: proof URL must not contain whitespace") } return trimmed }