0xtrr / cherry-server

A media server implementing the Blossom protocol.
3 stars 1 forks source link

Option to add extension based on MIME type to URL from upload #7

Open laanwj opened 1 week ago

laanwj commented 1 week ago

Currently at least nostrudel pastes the url field from the blob descriptor from an uploaded image directly into a nostr post. But nostr clients won't show an image when the URL doesn't end with an image extension such as jpeg, png, webp.

So from a usability point of view it would be useful if the blossom server added the extension. But this means that the server needs a map from upload MIME types to extensions, this isn't always straighforward.

Ostensibly, clients could also do this client-side (adding an extension is always allowed by the blossom protocol). And i imagine there are also non-nostr uses for blossom. So i'm not 100% sure this is a good thing to do server-side.

BUD 2 doesn't specify this, currently. See also discussion in hzrd149/blossom#25 and hzrd149/blossom#26 .

0xtrr commented 1 week ago

I think that makes perfectly sense, the server always has the context of the file so we could easily always serve with the filetype at the end. I don't think this breaks anything with the protocol so if you have any code for this, I'll happily review it. I can also try to add it after I get tests added (probably not this weekend).