fix(profile): upload banners without square-cropping them#450
Merged
Conversation
The profile editor sent both avatar and banner images to nostr.build's /api/v2/upload/profile endpoint, which crops to a square profile picture. The NIP-96 media_type='banner' hint isn't honored there (the endpoint's advertised transformations don't include avatar/banner cropping), so banners came out pfp-shaped. Route banner uploads through the general /api/v2/upload/files endpoint (the same one the composer uses), which preserves the uploaded aspect ratio. Avatars stay on /upload/profile where a square crop is correct. The NIP-98 auth 'u' tag and response parsing already key off the same url variable, so both paths stay consistent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Profile banner uploads came out square (pfp-shaped) because the profile editor sent banners to nostr.build's
/api/v2/upload/profileendpoint, which crops to a square profile picture. The NIP-96media_type='banner'hint added in #423-era work isn't honored by that endpoint (its advertisedmedia_transformations.imageis just resize/convert/compress — no avatar/banner cropping), so banners kept getting square-cropped.Fix
Route banner uploads through the general
/api/v2/upload/filesendpoint — the same one the composer uses — which preserves the uploaded aspect ratio. Avatars stay on/upload/profile, where a square crop is the correct behavior.The NIP-98 auth
['u', url]tag and thedata[0].urlresponse parsing already key off the sameurlvariable, so both paths stay consistent. The avatar-only uploader insrc/routes/user/[slug]/+page.sveltewas checked and is unaffected.Test plan