File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,6 +114,10 @@ func (r *Request) Get(path string) (*Response, error) {
114114 return r .Send (http .MethodGet , path )
115115}
116116
117+ func (r * Request ) Head (path string ) (* Response , error ) {
118+ return r .Send (http .MethodHead , path )
119+ }
120+
117121func (r * Request ) Post (path string ) (* Response , error ) {
118122 return r .Send (http .MethodPost , path )
119123}
Original file line number Diff line number Diff line change @@ -52,18 +52,18 @@ var fetchCmd = &cobra.Command{
5252 responseURL := api .PrefixedPath (fmt .Sprintf ("/livescan/%s/response/%s/" , scannerId , fileHash ))
5353 downloadURL := api .PrefixedPath (fmt .Sprintf ("/livescan/%s/download/%s/" , scannerId , fileHash ))
5454
55- resp , err := client .NewRequest ().Get ( responseURL )
55+ resp , err := client .NewRequest ().Head ( downloadURL )
5656 var url string
5757 switch {
58- case err == nil && resp .IsSuccess ():
59- url = responseURL
60- case resp != nil && resp .Response != nil && resp .StatusCode == http .StatusNotFound :
58+ case resp != nil && resp .Response != nil && resp .IsSuccess ():
6159 url = downloadURL
60+ case resp != nil && resp .Response != nil && resp .StatusCode == http .StatusNotFound :
61+ url = responseURL
6262 default :
6363 if err != nil {
6464 return err
6565 }
66- return fmt .Errorf ("unexpected error fetching %q" , responseURL )
66+ return fmt .Errorf ("unexpected error fetching %q" , downloadURL )
6767 }
6868
6969 opts := utils .NewDownloadOptions (
You can’t perform that action at this time.
0 commit comments