func()

in pkg/files/file_reader_writer.go [117:132]


func (r *LocalFileObjReader) extractPath(fileURL string) (string, error) {
	u, err := url.Parse(fileURL)
	if err != nil {
		return "", err
	}
	if u.Host != "" {
		return "", fmt.Errorf("unexpected host in url %q", u.Host)
	}
	if scheme := URLScheme(u.Scheme); scheme != EmptyScheme && scheme != FileScheme {
		return "", fmt.Errorf("unsupported scheme %q (local object reader supports only 'file://' scheme)", scheme)
	}
	if u.Scheme == "file" || !filepath.IsAbs(u.Path) {
		u.Path = filepath.Clean(filepath.Join(r.WorkingDir, u.Path))
	}
	return u.Path, nil
}