Ревью
This commit is contained in:
@@ -417,6 +417,13 @@ func (s *Server) uploadAttachment(w http.ResponseWriter, r *http.Request) {
|
||||
apperr.Write(w, id, apperr.PayloadTooLarge("image exceeds 40 megapixels"))
|
||||
return
|
||||
}
|
||||
// LAB 5 (ревью): целостность файла проверяется ДО приёма задания.
|
||||
// DecodeConfig читает только заголовок, поэтому усечённый PNG иначе
|
||||
// ушёл бы в очередь и упал уже в worker. Ресурсные лимиты сохранены.
|
||||
if ierr := validateImageIntegrity(data, contentType, width, height); ierr != nil {
|
||||
apperr.Write(w, id, apperr.UnsupportedMedia("file is corrupted or truncated"))
|
||||
return
|
||||
}
|
||||
|
||||
attID := uuid.NewString()
|
||||
stagingKey := store.StagingKey(chat.ID, attID)
|
||||
|
||||
Reference in New Issue
Block a user