Skip to content

fix(upload.py): fix upload for local#593

Merged
gustavocidornelas merged 1 commit intomainfrom
attachment_fix
Feb 13, 2026
Merged

fix(upload.py): fix upload for local#593
gustavocidornelas merged 1 commit intomainfrom
attachment_fix

Conversation

@shah-siddd
Copy link
Contributor

Pull Request

Summary

Fixes the 'NoneType' object is not a mapping error when uploading attachments (images, audio) with the Openlayer Python client against a local Openlayer deployment. Local presigned URLs omit S3 policy fields, but the client still passed None into **fields, causing the error.

Changes

  • attachment_uploader.py: Handle presigned_response.fields is None
    • Use explicit is not None check and convert to {} when missing
    • Wrap dict(presigned_response.fields) in try/except for robustness
  • upload_bytes_multipart: Guard against None when unpacking fields
    • Add fields = fields or {} so None is never used in **fields

Context

For local storage (OPENLAYER_BASE_URL=http://localhost:8080/v1), the presigned URL API returns url and storageUri but no fields. The client left fields as None, which led to **fields**None and the 'NoneType' object is not a mapping error during multipart upload.

Testing

  • Unit tests
  • Manual testing (local Openlayer + test_openlayer_multimodel.py)
  • Postman CI/CD
  • Other (please specify)

@gustavocidornelas gustavocidornelas merged commit 2d6500f into main Feb 13, 2026
5 checks passed
@gustavocidornelas gustavocidornelas deleted the attachment_fix branch February 13, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants