lab5: исправления второго ревью
Reprocess of a queued/processing/failed upload now sources from verified staging instead of the not-yet-written final original, which used to supersede v1 and strand the attachment in queued. PNG uploads now inflate the concatenated IDAT stream (bounded by IHDR dimensions) before acceptance, so a structurally valid PNG whose IDAT is not a zlib stream is rejected with 415 instead of 202.
This commit is contained in:
@@ -1338,9 +1338,24 @@ func (r *PipelineRepository) Reprocess(
|
||||
return fmt.Errorf("%w: target pipeline version must be newer", domain.ErrConflict)
|
||||
}
|
||||
|
||||
sourceKey := attachment.ObjectKey
|
||||
if attachment.Status == domain.AttachmentPending {
|
||||
return fmt.Errorf("%w: attachment upload is not complete", domain.ErrConflict)
|
||||
}
|
||||
|
||||
// The verified upload lives in staging until the first pipeline
|
||||
// publishes the final original. A queued/processing/failed attachment
|
||||
// must reprocess from staging: object_key points at a final original
|
||||
// that may not exist yet (worker stopped before the first run), and
|
||||
// choosing it would supersede v1 and leave the attachment queued with
|
||||
// no jobs after v2 fails with source_missing.
|
||||
sourceKey := attachment.StagingKey
|
||||
if attachment.Status == domain.AttachmentReady {
|
||||
// Ready means the final original was published; staging may have
|
||||
// passed its retention window already.
|
||||
sourceKey = attachment.ObjectKey
|
||||
}
|
||||
if sourceKey == "" {
|
||||
sourceKey = attachment.StagingKey
|
||||
sourceKey = attachment.ObjectKey
|
||||
}
|
||||
if sourceKey == "" {
|
||||
return fmt.Errorf("%w: attachment has no source object", domain.ErrConflict)
|
||||
|
||||
Reference in New Issue
Block a user