/
githubmirror
/
photoprism
Обзор
Документация
Войти
/
githubmirror
/
photoprism
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
pkg/clean/uri.go
40 строк
704 B
Michael Mayer
Config: Add "theme-url" option (pro/portal) and URI credential redaction
20 фев 2026, 04:15
20 фев 2026, 04:15
09ce485
Код
Авторство
О чём код?
package clean import ( "net/url" "strings" ) // Uri removes invalid character from an uri string. func Uri(s string) string { if s == "" || len(s) > LengthLimit { return "" } else if strings.Contains(s, "..") { return "" } // Trim whitespace. s = strings.TrimSpace(s) if uri, err := url.Parse(s); err != nil { return "" } else { return uri.String() } } // UriRedacted removes credentials from a URI string while preserving non-sensitive components. func UriRedacted(s string) string { if s == "" || len(s) > LengthLimit { return "" } // Trim whitespace. s = strings.TrimSpace(s) if uri, err := url.Parse(s); err != nil { return "" } else { return uri.Redacted() } }