Skip to content

fix(profile): upload banners without square-cropping them#450

Merged
spe1020 merged 2 commits into
zapcooking:mainfrom
dmnyc:fix/profile-banner-upload
Jun 17, 2026
Merged

fix(profile): upload banners without square-cropping them#450
spe1020 merged 2 commits into
zapcooking:mainfrom
dmnyc:fix/profile-banner-upload

Conversation

@dmnyc

@dmnyc dmnyc commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Profile banner uploads came out square (pfp-shaped) because the profile editor sent banners to nostr.build's /api/v2/upload/profile endpoint, which crops to a square profile picture. The NIP-96 media_type='banner' hint added in #423-era work isn't honored by that endpoint (its advertised media_transformations.image is just resize/convert/compress — no avatar/banner cropping), so banners kept getting square-cropped.

Fix

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 the correct behavior.

const url =
  type === 'picture'
    ? 'https://nostr.build/api/v2/upload/profile'  // square pfp crop
    : 'https://nostr.build/api/v2/upload/files';    // preserves aspect ratio

The NIP-98 auth ['u', url] tag and the data[0].url response parsing already key off the same url variable, so both paths stay consistent. The avatar-only uploader in src/routes/user/[slug]/+page.svelte was checked and is unaffected.

Test plan

  1. Open the profile editor and upload a wide banner image → it stays wide (no longer square-cropped).
  2. Upload an avatar → still correctly square-cropped.

dmnyc and others added 2 commits June 17, 2026 00:35
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.
@spe1020 spe1020 merged commit 6989868 into zapcooking:main Jun 17, 2026
4 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