Skip to content

Header and Avatar upload: Add "filename" to Content-Disposition

Gabriel Kind requested to merge ghabry/tokodon:gotosocial-compat into master

The filename is optional but required by gotosocial.

They decided to not fix this due to limitation in the network library they use. See https://github.com/superseriousbusiness/gotosocial/issues/1958


I'm not a huge fan of adding workarounds to clients but they considered it infeasible to fix, so...

The filename itself doesn't matter. The network library used by gotosocial only wants to see filename= but the filename itself is ignored.

To quote the dev in the linked issue:

Unfortunately this comes down to a rather brittle binding API in gin-gonic and bad mime/multipart standard library behaviour on Go's part (see: golang/go#19183).

So unfortunately without getting really hacky, (I started working on this and will require a lot of > extra request data juggling without...), it's not going to be possible.

I did take a look at alternative 3rd-party libraries but they all seem to be not-battle-tested and unmaintained (see: https://github.com/albrow/forms, https://github.com/neox5/go-formdata).

Merge request reports