Files
filestore/remote/helper.go
T
2025-10-29 00:59:52 +03:00

24 lines
404 B
Go

package remote
import (
"errors"
"strings"
)
var (
ErrNoScheme = errors.New("no scheme")
ErrEmptyURL = errors.New("URL cannot be empty")
)
// schemeFromURL возвращает схему из строки URL.
func schemeFromURL(url string) (string, error) {
if url == "" {
return "", ErrEmptyURL
}
i := strings.Index(url, ":")
if i < 1 {
return "", ErrNoScheme
}
return url[:i], nil
}