Skip to content

Commit

Permalink
asset: drop known file extension check
Browse files Browse the repository at this point in the history
Not all files have extensions (eg unix executables). This was being
reported to the client as NotFound, and bazel seems to have a bug
where it assumes that the result was always successful and then errors
out with a hash verification error.

We should be able to download the file in this particular case
regardless of the bazel bug.

Background: #310.
  • Loading branch information
mostynb committed Jul 15, 2020
1 parent 79be5fa commit cc90306
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions server/grpc_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"io/ioutil"
"net/http"
"net/url"
"path/filepath"
"strings"

"google.golang.org/genproto/googleapis/rpc/status"
Expand Down Expand Up @@ -115,15 +114,6 @@ func (s *grpcServer) FetchBlob(ctx context.Context, req *asset.FetchBlobRequest)
}, nil
}

// Simple files (not eg git).
var simpleExtensions = map[string]struct{}{
".gz": {},
".xz": {},
".bz2": {},
".tar": {},
".zip": {},
}

func (s *grpcServer) fetchItem(uri string, expectedHash string) (bool, string, int64) {
u, err := url.Parse(uri)
if err != nil {
Expand All @@ -136,11 +126,6 @@ func (s *grpcServer) fetchItem(uri string, expectedHash string) (bool, string, i
return false, "", int64(-1)
}

_, simple := simpleExtensions[filepath.Ext(u.Path)]
if !simple {
return false, "", int64(-1)
}

resp, err := http.Get(uri)
if err != nil {
s.errorLogger.Printf("failed to get URI: %s err: %v", uri, err)
Expand Down

0 comments on commit cc90306

Please sign in to comment.