nbd-wtf / nostr-tools

Tools for developing Nostr clients.
The Unlicense
685 stars 188 forks source link

Fix NIP-96 uploads #420

Closed Ademan closed 1 month ago

Ademan commented 1 month ago

Surprising one liner change (and boy was it hard for me to track down) but the Content-Type header should not be explicitly set.

See https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest_API/Using_FormData_Objects#sending_files_using_a_formdata_object

Warning: When using FormData to submit POST requests using XMLHttpRequest or the Fetch API with the multipart/form-data content type (e.g. when uploading files and blobs to the server), do not explicitly set the Content-Type header on the request. Doing so will prevent the browser from being able to set the Content-Type header with the boundary expression it will use to delimit form fields in the request body.

Ademan commented 1 month ago

Geeze after all this I see someone else has an open PR for this...

fiatjaf commented 1 month ago

Oops, I hadn't seen that other PR. Sorry, and thank you for noticing it.