1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-27 17:28:38 +00:00

refactor(internal): add an urllib.DomainWithoutWWW function

This commit is contained in:
jvoisin 2025-06-17 16:34:13 +02:00
parent d291d6a74d
commit 56ca7030cb
3 changed files with 7 additions and 3 deletions

View file

@ -83,6 +83,11 @@ func Domain(websiteURL string) string {
return parsedURL.Host
}
// DomainWithoutWWW returns only the domain part of the given URL, with the "www." prefix removed if present.
func DomainWithoutWWW(websiteURL string) string {
return strings.TrimPrefix(Domain(websiteURL), "www.")
}
// JoinBaseURLAndPath returns a URL string with the provided path elements joined together.
func JoinBaseURLAndPath(baseURL, path string) (string, error) {
if baseURL == "" {