src/server/pkg/obj/obj.go
func ParseURL(urlStr string) (*ObjectStoreURL, error) {
	url, err := url.Parse(urlStr)
	if err != nil {
		return nil, fmt.Errorf("error parsing url %v: %v", urlStr, err)
	}
	switch url.Scheme {
	case "s3", "gcs", "gs", "local":
		return &ObjectStoreURL{
			Store:  url.Scheme,
			Bucket: url.Host,
			Object: strings.Trim(url.Path, "/"),
		}, nil
	case "as", "wasb":
		// In Azure, the first part of the path is the container name.
		parts := strings.Split(strings.Trim(url.Path, "/"), "/")
		if len(parts) < 1 {
			return nil, fmt.Errorf("malformed Azure URI: %v", urlStr)
		}
		return &ObjectStoreURL{
			Store:  url.Scheme,
			Bucket: parts[0],
			Object: strings.Trim(path.Join(parts[1:]...), "/"),
		}, nil
	}
	return nil, fmt.Errorf("unrecognized object store: %s", url.Scheme)
}
func ParseURL(urlStr string) (*ObjectStoreURL, error) {
	url, err := url.Parse(urlStr)
	if err != nil {
		return nil, fmt.Errorf("error parsing url %v: %v", urlStr, err)
	}
	switch url.Scheme {
	case "s3", "gcs", "gs", "local":
		return &ObjectStoreURL{
			Store:  url.Scheme,
			Bucket: url.Host,
			Object: strings.Trim(url.Path, "/"),
		}, nil
	case "as", "wasb":
		// In Azure, the first part of the path is the container name.
		parts := strings.Split(strings.Trim(url.Path, "/"), "/")
		if len(parts) < 1 {
			return nil, fmt.Errorf("malformed Azure URI: %v", urlStr)
		}
		return &ObjectStoreURL{
			Store:  url.Scheme,
			Bucket: parts[0],
			Object: strings.Trim(path.Join(parts[1:]...), "/"),
		}, nil
	}
	return nil, fmt.Errorf("unrecognized object store: %s", url.Scheme)
}
func ParseURL ( urlStr string ) ( * ObjectStoreURL , error ) { url , err := url . Parse ( urlStr ) if err != nil { return nil , fmt . Errorf ( " " , urlStr , err ) } switch url . Scheme { case " " , " " , " " , " " : return & ObjectStoreURL { Store : url . Scheme , Bucket : url . Host , Object : strings . Trim ( url . Path , " " ) , } , nil case " " , " " : // In Azure, the first part of the path is the container name. parts := strings . Split ( strings . Trim ( url . Path , " " ) , " " ) if len ( parts ) < 1 { return nil , fmt . Errorf ( " " , urlStr ) } return & ObjectStoreURL { Store : url . Scheme , Bucket : parts [ 0 ] , Object : strings . Trim ( path . Join ( parts [ 1 : ] ... ) , " " ) , } , nil } return nil , fmt . Errorf ( " " , url . Scheme ) }
// ParseURL parses an URL into ObjectStoreURL.
ParseURL parses an URL into ObjectStoreURL .