From cc9030667416ab63d89b9fbf543f0243292009b4 Mon Sep 17 00:00:00 2001 From: Mostyn Bramley-Moore Date: Thu, 16 Jul 2020 00:48:32 +0200 Subject: [PATCH] asset: drop known file extension check 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. --- server/grpc_asset.go | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/server/grpc_asset.go b/server/grpc_asset.go index 56e5f6533..09351f764 100644 --- a/server/grpc_asset.go +++ b/server/grpc_asset.go @@ -9,7 +9,6 @@ import ( "io/ioutil" "net/http" "net/url" - "path/filepath" "strings" "google.golang.org/genproto/googleapis/rpc/status" @@ -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 { @@ -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)