Skip to content

Conversation

@hamchowderr
Copy link

Fixes user-facing issue where uploaded files couldn't be previewed in browsers due to missing Content-Type headers.

Internal changes:

  • Add get_content_type() function to detect MIME types from file extensions
  • Set ContentType in boto3 upload_fileobj() and create_multipart_upload()
  • Set content_type for GCP blob uploads
  • Uses Python's mimetypes module with fallback to application/octet-stream

External impact:

  • Videos, audio, images now preview inline in browsers instead of forcing download
  • Browsers can properly identify and handle media file types
  • Improves user experience for media file access

Modified files:

  • services/file_management.py (new get_content_type function)
  • services/s3_toolkit.py (ContentType in ExtraArgs)
  • services/gcp_toolkit.py (blob.content_type assignment)
  • services/v1/s3/upload.py (ContentType in multipart upload)

Fixes user-facing issue where uploaded files couldn't be previewed in
browsers due to missing Content-Type headers.

Internal changes:
- Add get_content_type() function to detect MIME types from file extensions
- Set ContentType in boto3 upload_fileobj() and create_multipart_upload()
- Set content_type for GCP blob uploads
- Uses Python's mimetypes module with fallback to application/octet-stream

External impact:
- Videos, audio, images now preview inline in browsers instead of forcing download
- Browsers can properly identify and handle media file types
- Improves user experience for media file access

Modified files:
- services/file_management.py (new get_content_type function)
- services/s3_toolkit.py (ContentType in ExtraArgs)
- services/gcp_toolkit.py (blob.content_type assignment)
- services/v1/s3/upload.py (ContentType in multipart upload)
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