Skip to content

Conversation

@athola
Copy link
Owner

@athola athola commented Dec 24, 2025

Summary

  • Fixes upload failures for .js and .html files with 415 invalid_mime_type errors
  • Replaces supabase storage cp CLI with direct REST API calls using curl
  • Adds get_mime_type() function that returns clean MIME types without charset suffix

Problem

The Supabase CLI's storage cp command auto-detects MIME types and adds ; charset=utf-8 suffix (e.g., text/javascript; charset=utf-8). Supabase Storage API rejects these extended MIME types with a 415 error.

Solution

Use the Storage REST API directly with curl, where we control the exact Content-Type header. The custom get_mime_type function maps file extensions to clean MIME types.

Test plan

  • Merge to master and verify deployment workflow succeeds
  • Confirm all 24 static files upload successfully
  • Verify site loads at the Supabase Storage URL

🤖 Generated with Claude Code

athola and others added 2 commits December 23, 2025 19:37
Supabase Storage rejects MIME types with charset suffix (e.g.,
'text/javascript; charset=utf-8'). The supabase CLI's storage cp
command auto-detects MIME types and adds charset, causing 415 errors.

This fix replaces CLI uploads with direct REST API calls using curl,
with a custom get_mime_type function that returns clean MIME types
without charset suffix.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The upload test was using multipart form upload (-F flag) which auto-
detects MIME type as text/plain. The bucket only allows specific MIME
types, so the test was failing.

Changed test to:
- Use JSON file instead of plain text
- Use --data-binary with explicit Content-Type header
- Match exactly how deploy.yml uploads files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Owner Author

@athola athola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review Summary

Scope Analysis

Problem: Supabase Storage rejects MIME types with ; charset=utf-8 suffix. The supabase storage cp CLI auto-adds this, causing 415 errors for .js and .html files.

Solution: Replace CLI with direct REST API calls using curl with explicit Content-Type headers.

Blocking Issues (0)

✅ None found. This is a focused, targeted fix.

In-Scope Issues (0)

✅ All requirements addressed.

Suggestions (2)

ID Description Priority
G1 MIME type coverage is complete for bucket's allowed types Info
G2 Consider adding upload success logging (low priority) Low

Quality Assessment

Aspect Status
Solves root cause ✅ Uses REST API to control exact headers
Matches allowed types ✅ All bucket MIME types covered
Test alignment ✅ dry-run now uses same method as deploy
Error handling ✅ Retry logic preserved, HTTP status shown
Security ✅ No secrets exposed, uses existing patterns

Recommendation

APPROVE - Clean, focused fix that addresses the root cause. Ready to merge.


Review generated by Claude Code PR Review

Copy link
Owner Author

@athola athola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Issues Found & Fixed

Priority Issue Status
Important Missing x-upsert: true header in dry-run test ✅ Fixed
Important Fallback MIME type application/octet-stream not in allowed list ✅ Fixed

Fixes Applied (pending push)

  1. deploy-dry-run.yml: Added x-upsert: true header to match production upload behavior
  2. deploy.yml: Added text/plain and application/octet-stream to bucket's allowed_mime_types

Positive Observations

  • ✅ Proper error handling with set +e / set -e around curl calls
  • ✅ Good retry logic with exponential backoff (sleep $((attempt * 2)))
  • ✅ Correct --data-binary usage preserves file contents exactly
  • ✅ Secrets properly passed via headers (not CLI args)
  • ✅ HTTP status extraction pattern is reliable
  • x-upsert: true in production prevents 409 conflicts

Version Bump

Also includes version bump to 0.1.7 with changelog entries for both 0.1.6 and 0.1.7 releases.

Recommendation

APPROVE after pushing the review fixes. All identified issues have been addressed.


Review generated by Claude Code PR Review

Version bump:
- pyproject.toml: 0.1.5 → 0.1.7
- frontend/package.json: 0.1.1 → 0.1.7
- CHANGELOG.md: Added 0.1.6 and 0.1.7 entries

Review fixes:
- deploy-dry-run.yml: Add x-upsert header to match production
- deploy.yml: Add text/plain and application/octet-stream to allowed MIME types

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@athola
Copy link
Owner Author

athola commented Dec 24, 2025

Review Feedback Resolution Summary

All review feedback has been addressed:

Issues Fixed (in commit 66fc4b4)

Issue Description Status
Missing x-upsert header dry-run now matches production upload behavior ✅ Fixed
Fallback MIME type Added text/plain and application/octet-stream to allowed types ✅ Fixed

Out-of-Scope Items → GitHub Issues

Review Item Issue Created Description
G2 #28 Add upload success logging for debugging

Informational Items

Item Description Action
G1 MIME type coverage is complete No action needed

Generated by Enhanced PR Fix workflow

@athola athola merged commit 3eddb37 into master Dec 24, 2025
7 checks passed
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