Complete artifact binary transfer streaming

This commit is contained in:
npc0-hue
2026-09-03 13:27:22 +08:00
parent fe09d21a56
commit ec2462a312
8 changed files with 178 additions and 35 deletions
+10 -5
View File
@@ -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},