mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-28 08:22:24 +00:00
With both Backblaze B2 and Cloudflare R2 configured, an upload could fail with "S3 endpoint is required." when the upload modal's tracked provider drifted out of sync with the active credentials (user: storage selector on Backblaze but the modal set for Cloudflare). A Cloudflare R2 connection stores an accountId and derives its endpoint, so routing it through the S3 service — which requires an explicit endpoint — threw. Fix: MediaUploader.uploadVideo/uploadThumbnail now choose the service + provider from the CREDENTIALS' own provider (credentials.provider || credentials.meta.provider || provider), so a stale modal provider can no longer send an R2 connection through the S3 path (or vice-versa). The R2 service derives the endpoint from accountId as before. Test: tests/media-uploader-provider-routing.test.mjs (4 — R2 creds route to r2Service even with a stale Backblaze arg; B2 creds route to s3Service; meta.provider + passed-arg fallbacks). Build + lint clean; upload/storage suites green. Co-Authored-By: Claude Opus 4.8 <[email protected]>