add test for listartifacts v4 filter (#2507)
* add test for listartifacts v4 filter * fixes a defect of last change * Update artifacts.yml * use 32bit ids after cast to double we have a loss * Update artifacts.yml
This commit is contained in:
@@ -121,9 +121,9 @@ type ArtifactContext struct {
|
||||
}
|
||||
|
||||
func artifactNameToID(s string) int64 {
|
||||
h := fnv.New64a()
|
||||
h := fnv.New32a()
|
||||
h.Write([]byte(s))
|
||||
return int64(h.Sum64())
|
||||
return int64(h.Sum32())
|
||||
}
|
||||
|
||||
func (c ArtifactContext) Error(status int, _ ...interface{}) {
|
||||
@@ -376,7 +376,7 @@ func (r *artifactV4Routes) listArtifacts(ctx *ArtifactContext) {
|
||||
|
||||
for _, entry := range entries {
|
||||
id := artifactNameToID(entry.Name())
|
||||
if (req.NameFilter == nil || req.NameFilter.Value == entry.Name()) || (req.IdFilter == nil || req.IdFilter.Value == id) {
|
||||
if (req.NameFilter == nil || req.NameFilter.Value == entry.Name()) && (req.IdFilter == nil || req.IdFilter.Value == id) {
|
||||
data := &ListArtifactsResponse_MonolithArtifact{
|
||||
Name: entry.Name(),
|
||||
CreatedAt: timestamppb.Now(),
|
||||
|
||||
Reference in New Issue
Block a user