Complete artifact binary transfer streaming
This commit is contained in:
@@ -101,17 +101,22 @@ func ValidateArtifactContent(content domain.ArtifactContent) error {
|
||||
if content.SizeBytes > maxContentBytes {
|
||||
violations = append(violations, fmt.Sprintf("sizeBytes must not exceed %d", maxContentBytes))
|
||||
}
|
||||
if int64(len(content.Payload)) != content.SizeBytes {
|
||||
violations = append(violations, "payload size must match sizeBytes")
|
||||
}
|
||||
if content.Offset+content.SizeBytes > content.TotalSizeBytes {
|
||||
violations = append(violations, "range exceeds artifact size")
|
||||
}
|
||||
if content.Checksum != "" && !validSHA256Checksum(content.Checksum) {
|
||||
violations = append(violations, "checksum must be sha256:<hex>")
|
||||
}
|
||||
if content.ContentChecksum != "" && content.ContentChecksum != BytesChecksum(content.Payload) {
|
||||
violations = append(violations, "contentChecksum does not match payload")
|
||||
if content.ContentChecksum != "" && !validSHA256Checksum(content.ContentChecksum) {
|
||||
violations = append(violations, "contentChecksum must be sha256:<hex>")
|
||||
}
|
||||
if content.Payload != nil {
|
||||
if int64(len(content.Payload)) != content.SizeBytes {
|
||||
violations = append(violations, "payload size must match sizeBytes")
|
||||
}
|
||||
if content.ContentChecksum != "" && content.ContentChecksum != BytesChecksum(content.Payload) {
|
||||
violations = append(violations, "contentChecksum does not match payload")
|
||||
}
|
||||
}
|
||||
for _, value := range []fieldString{
|
||||
{field: "filename", value: content.Filename},
|
||||
|
||||
Reference in New Issue
Block a user