fix: before approving, the panel learns that a file cannot be a final and says to treat the art (DTF-WEB-11)
All checks were successful
Build and deploy / Validate source (push) Successful in 8s
Build and deploy / Integration suite on a real stack (push) Successful in 7m15s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 2m28s
All checks were successful
Build and deploy / Validate source (push) Successful in 8s
Build and deploy / Integration suite on a real stack (push) Successful in 7m15s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 2m28s
The panel offered the customer's correction (or an original) as ready to
approve, and the server refused it as not a transparent 300 DPI PNG,
an error for Sentry. POST /orders/{id}/final-check reads the header of
the order's own files with the same check as the approval and answers
200 with the problems; "Aprovar arquivo final" asks it first and, when a
file cannot be a final, says why and to use "Tratar a arte".
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -47,12 +47,18 @@ def final_png_issue(data):
|
||||
return None
|
||||
|
||||
|
||||
def require_final_png(storage, upload):
|
||||
from fastapi import HTTPException
|
||||
def final_png_problem(storage, upload):
|
||||
"""Why this upload cannot be a final file, or None: its name and the
|
||||
header chunks of the stored file."""
|
||||
if not upload['name'].lower().endswith('.png'):
|
||||
raise HTTPException(422, 'O arquivo final precisa ser PNG transparente a 300 DPI. Converta PDF/TIFF antes de enviar.')
|
||||
return 'O arquivo final precisa ser PNG transparente a 300 DPI. Converta PDF/TIFF antes de enviar.'
|
||||
response = storage.client.get_object(Bucket=storage.bucket, Key=upload['object_key'],
|
||||
Range=f'bytes=0-{HEADER_BYTES - 1}')
|
||||
issue = final_png_issue(response['Body'].read())
|
||||
return final_png_issue(response['Body'].read())
|
||||
|
||||
|
||||
def require_final_png(storage, upload):
|
||||
from fastapi import HTTPException
|
||||
issue = final_png_problem(storage, upload)
|
||||
if issue:
|
||||
raise HTTPException(422, issue)
|
||||
|
||||
Reference in New Issue
Block a user