Skip to content

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)

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.

1 participant