mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
The Edit Profile image + banner upload was wired (resolve connection -> uploadFile -> auto-fill URL) but silently broken: ProfileEditController passes a HEX pubkey to r2Service.resolveConnection(), which only decoded npub1... strings via safeDecodeNpub. A hex pubkey therefore resolved to null -> "Storage configuration missing" and the Upload button stayed disabled even with storage configured. (Thumbnails worked because mediaUploader calls listConnections(pubkey) directly.) Fix: resolveConnection() now accepts a hex pubkey OR an npub. The rest of the chain is already provider-agnostic (resolveConnection returns the defaultForUploads connection's endpoint/baseDomain/forcePathStyle, uploadFile routes R2 vs generic-S3 by provider, buildPublicUrl builds the URL), so profile/banner upload now works for R2 / B2 / Custom S3. Test: tests/r2-resolve-connection-hex.test.mjs (3 — nip19.decode throws on hex to prove the hex path is used, plus npub still works and empty returns null). Build + lint clean; r2/storage suites green. Co-Authored-By: Claude Opus 4.8 <[email protected]>