gabriel / musehub public
fix BREAKING main #7 / 34
AI Agent gabriel · 116 days ago · May 10, 2026 · Diff

fix: rewrite presigned URL hostnames via R2_PUBLIC_ENDPOINT

BlobBackend embeds its endpoint_url into every presigned URL via boto3. In local dev that is http://minio:9000 (Docker-internal) which is unreachable from the host. _rewrite_presign_url() replaces the internal endpoint with R2_PUBLIC_ENDPOINT when set, applied to presign_put and presign_batch. docker-compose.override sets R2_PUBLIC_ENDPOINT and R2_PUBLIC_ENDPOINT=http://localhost:9000 for local dev.

sha256:bba0cbfe5297dcff248ddc92ed451e63b3239e4e8ace4f904567e7caee1e05ce sha
+9 ~5 symbols
sha256:4fb27d4b00763a650e8889e911defb4def5030547cfbff8d8b3bed533afd8b2d snapshot
+9
symbols added
~5
symbols modified
0
dead code introduced
Semantic Changes 14 symbols
~ musehub/config.py .py 1 symbol modified
~ musehub/storage/backends.py .py 1 symbol added, 4 symbols modified
+ _rewrite_presign_url method method _rewrite_presign_url L316–327
~ tests/test_blob_backend_unit.py .py 8 symbols added
+ TestPresignPublicEndpoint class class TestPresignPublicEndpoint L180–261
+ _backend_with_internal_and_public method method _backend_with_internal_and_public L189–201
+ _backend_without_public method method _backend_without_public L203–214
+ test_presign_batch_no_rewrite_when_public_endpoint_absent method async_method test_presign_batch_no_rewrite_when_public_endpoint_absent L240–250
+ test_presign_batch_rewrites_all_urls method async_method test_presign_batch_rewrites_all_urls L227–238
+ test_presign_put_no_rewrite_when_public_endpoint_absent method async_method test_presign_put_no_rewrite_when_public_endpoint_absent L222–225
+ test_presign_put_preserves_path_and_query method async_method test_presign_put_preserves_path_and_query L252–261
+ test_presign_put_rewrites_host_when_public_endpoint_set method async_method test_presign_put_rewrites_host_when_public_endpoint_set L216–220

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:bba0cbfe5297dcff248ddc92ed451e63b3239e4e8ace4f904567e7caee1e05ce --body "your comment"