Skip to content

Commit

Permalink
Merge pull request kubernetes#2113 from justinsb/vfs_path_validation_…
Browse files Browse the repository at this point in the history
…error

Fix error for invalid vfs paths
  • Loading branch information
yissachar authored Mar 19, 2017
2 parents 0a45503 + 32b9e1b commit e873950
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions util/pkg/vfs/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,15 @@ func RetryWithBackoff(backoff wait.Backoff, condition func() (bool, error)) (boo
func (c *VFSContext) buildS3Path(p string) (*S3Path, error) {
u, err := url.Parse(p)
if err != nil {
return nil, fmt.Errorf("invalid s3 path: %q", err)
return nil, fmt.Errorf("invalid s3 path: %q", p)
}
if u.Scheme != "s3" {
return nil, fmt.Errorf("invalid s3 path: %q", err)
return nil, fmt.Errorf("invalid s3 path: %q", p)
}

bucket := strings.TrimSuffix(u.Host, "/")
if bucket == "" {
return nil, fmt.Errorf("invalid s3 path: %q", err)
return nil, fmt.Errorf("invalid s3 path: %q", p)
}

s3path := newS3Path(c.s3Context, bucket, u.Path)
Expand Down Expand Up @@ -242,11 +242,11 @@ func (c *VFSContext) ResetMemfsContext(clusterReadable bool) {
func (c *VFSContext) buildGCSPath(p string) (*GSPath, error) {
u, err := url.Parse(p)
if err != nil {
return nil, fmt.Errorf("invalid google cloud storage path: %q", err)
return nil, fmt.Errorf("invalid google cloud storage path: %q", p)
}

if u.Scheme != "gs" {
return nil, fmt.Errorf("invalid google cloud storage path: %q", err)
return nil, fmt.Errorf("invalid google cloud storage path: %q", p)
}

bucket := strings.TrimSuffix(u.Host, "/")
Expand Down

0 comments on commit e873950

Please sign in to comment.