internal/proxy: return BadModule on bad zip
If zip.NewReader can't open the zip file, treat this as a bad module
(490) rather than a server error (500). That way we won't pointlessly
retry fetching the module.
Fixes b/166101385
@@ -89,7 +89,7 @@ func (c *Client) GetZip(ctx context.Context, requestedPath, requestedVersion str
}
zipReader, err := zip.NewReader(bytes.NewReader(bodyBytes), int64(len(bodyBytes)))
if err != nil {
- return nil, fmt.Errorf("zip.NewReader: %v", err)
+ return nil, fmt.Errorf("zip.NewReader: %v: %w", err, derrors.BadModule)
}
return zipReader, nil
}
