// CleanURI returns URI without `/`, `\`', `{`, and `}`
330048
func (r *Resource) CleanURI() string {
	s := removeDoubleSlash(r.URI)
	return strings.TrimSpace(removeDoubleChevron(s))
}
97336
func ParseAndValidateURIs(uriList string) (res []*url.URL, err error) {
	if len(uriList) > 0 {
		uris := strings.Split(uriList, ",")
		for _, uri := range uris {
			parsedURI, err := url.Parse(uri)
			if err != nil {
				parsedURI = nil
			}
			if parsedURI == nil {
				return nil, fmt.Errorf("Invalid URI: %s", uri)
			}
			if !parsedURI.IsAbs() {
				return nil, fmt.Errorf("Invalid URI: %s", uri)
			}
			res = append(res, parsedURI)
		}
	}
	return
}
512886
func (r *Repo) Clean() {
	r.mu.Lock()
	if r.dir != "" {
		os.RemoveAll(r.dir)
	}
	r.dir = ""
	r.status = RepoNew
	r.mu.Unlock()
}
18118
func cleanPath(s string) (string, error) {
	s = strings.Trim(s, "/")
	if strings.HasPrefix(s, ":") {
		return "", fmt.Errorf("Path cannot be made up of just a tag: %q", s)
	}
	return s, nil
}
479208
func (c *Cleaner) cleanBr(doc *goquery.Document) *goquery.Document {
	linebreaks := doc.Find("br")
	linebreaks.Each(func(i int, br *goquery.Selection) {
		node := br.Get(0)
		node.Data = "\n\n"
		node.Type = html.TextNode
		node.Attr = []html.Attribute{}
		node.DataAtom = 0
		node.FirstChild = nil
		node.LastChild = nil
	})
	return doc
}
184086
func (s RepoChartSource) CleanRepoURL() string {
	cleanURL := strings.TrimRight(s.RepoURL, "/")
	return cleanURL + "/"
}
316463
func sanitizeURL(uri *url.URL) *url.URL {
	if uri == nil {
		return nil
	}
	params := uri.Query()
	if len(params.Get(ACCESSKEY)) > 0 {
		params.Set(ACCESSKEY, "REDACTED")
		uri.RawQuery = params.Encode()
	}
	return uri
}
1341706
func (e *Echo) URI(handler interface{}, params ...interface{}) string {
	var uri, name string
	if h, ok := handler.(Handler); ok {
		if hn, ok := h.(Name); ok {
			name = hn.Name()
		} else {
			name = HandlerName(h)
		}
	} else if h, ok := handler.(string); ok {
		name = h
	} else {
		return uri
	}
	if indexes, ok := e.router.nroute[name]; ok && len(indexes) > 0 {
		r := e.router.routes[indexes[0]]
		length := len(params)
		if length == 1 {
			switch val := params[0].(type) {
			case url.Values:
				uri = r.Path
				for _, name := range r.Params {
					tag := `:` + name
					v := val.Get(name)
					uri = strings.Replace(uri, tag+`/`, v+`/`, -1)
					if strings.HasSuffix(uri, tag) {
						uri = strings.TrimSuffix(uri, tag) + v
					}
					val.Del(name)
				}
				q := val.Encode()
				if len(q) > 0 {
					uri += `?` + q
				}
			case map[string]string:
				uri = r.Path
				for _, name := range r.Params {
					tag := `:` + name
					v, y := val[name]
					if y {
						delete(val, name)
					}
					uri = strings.Replace(uri, tag+`/`, v+`/`, -1)
					if strings.HasSuffix(uri, tag) {
						uri = strings.TrimSuffix(uri, tag) + v
					}
				}
				sep := `?`
				keys := make([]string, 0, len(val))
				for k := range val {
					keys = append(keys, k)
				}
				sort.Strings(keys)
				for _, k := range keys {
					uri += sep + url.QueryEscape(k) + `=` + url.QueryEscape(val[k])
					sep = `&`
				}
			case []interface{}:
				uri = fmt.Sprintf(r.Format, val...)
			default:
				uri = fmt.Sprintf(r.Format, val)
			}
		} else {
			uri = fmt.Sprintf(r.Format, params...)
		}
	}
	return uri
}
96117
func (r *URIBuilder) ClientURI(s string) *URIBuilder {
	r.clientURI = s
	return r
}
318713
func DataURI(m *M, dataURI []byte) []byte {
	if mediatype, data, err := parse.DataURI(dataURI); err == nil {
		dataURI, _ = m.Bytes(string(mediatype), data)
		base64Len := len(";base64") + base64.StdEncoding.EncodedLen(len(dataURI))
		asciiLen := len(dataURI)
		for _, c := range dataURI {
			if 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' || c == '-' || c == '_' || c == '.' || c == '~' || c == ' ' {
				asciiLen++
			} else {
				asciiLen += 2
			}
			if asciiLen > base64Len {
				break
			}
		}
		if asciiLen > base64Len {
			encoded := make([]byte, base64Len-len(";base64"))
			base64.StdEncoding.Encode(encoded, dataURI)
			dataURI = encoded
			mediatype = append(mediatype, []byte(";base64")...)
		} else {
			dataURI = []byte(url.QueryEscape(string(dataURI)))
			dataURI = bytes.Replace(dataURI, []byte("\""), []byte("\\\""), -1)
		}
		if len("text/plain") <= len(mediatype) && parse.EqualFold(mediatype[:len("text/plain")], []byte("text/plain")) {
			mediatype = mediatype[len("text/plain"):]
		}
		for i := 0; i+len(";charset=us-ascii") <= len(mediatype); i++ {
			// must start with semicolon and be followed by end of mediatype or semicolon
			if mediatype[i] == ';' && parse.EqualFold(mediatype[i+1:i+len(";charset=us-ascii")], []byte("charset=us-ascii")) && (i+len(";charset=us-ascii") >= len(mediatype) || mediatype[i+len(";charset=us-ascii")] == ';') {
				mediatype = append(mediatype[:i], mediatype[i+len(";charset=us-ascii"):]...)
				break
			}
		}
		dataURI = append(append(append([]byte("data:"), mediatype...), ','), dataURI...)
	}
	return dataURI
}
549923
func clean() (err error) {
	if err := r.Settings.Remove(realize.RFile); err != nil {
		return err
	}
	log.Println(r.Prefix(realize.Green.Bold("folder successfully removed")))
	return nil
}
254728
func (server *UnixServer) URI() string {
	if server.listener == nil {
		panic(ErrServerIsNotStarted)
	}
	return "unix:" + server.listener.Addr().String()
}
1140123
func (k DirectionalPoolKey) QueryURI(query string, offset int) string {
	uri := k.URI()

	if query != "" {
		uri = fmt.Sprintf("%s?sort=NAME&query=%s&offset=%d", uri, query, offset)
	} else {
		uri = fmt.Sprintf("%s?offset=%d", uri, offset)
	}

	return uri
}
592793
func cleanURL(url *string) {
	ulen := len((*url))
	if ulen > 1 {
		if (*url)[ulen-1:] == "/" {
			*url = (*url)[:ulen-1]
			cleanURL(url)
		}
	}
}
768337
func clean(parameter string) string {
	replacer := strings.NewReplacer("\n", " ", "\t", "")
	return replacer.Replace(parameter)
}
397955
func (c *logCache) LogURIs() []string {
	c.RLock()
	defer c.RUnlock()
	var uris []string
	for _, l := range c.logs {
		uris = append(uris, l.uri)
	}
	return uris
}
414115
func (c *OAuthAccessCall) RedirectURI(redirectURI string) *OAuthAccessCall {
	c.redirectURI = redirectURI
	return c
}