TheBLVD / mammoth

GNU Affero General Public License v3.0
172 stars 11 forks source link

Adding animated gif fails in error #593

Open Depechie opened 1 week ago

Depechie commented 1 week ago

Describe the bug

Each time I select an animated gif to be added to a toot, through the GIF button, I get an exception.

To Reproduce

Click enter new toot Select gif button below Select gif

Expected behaviour

The gif should be added

Screenshots

IMG_3492

Instance address

Dotnet.social

Device

iPhone Xr

OS

17.5.1

Version

2.13 build 467

Additional context

No response

kernjackson commented 4 days ago

Looking at the Mastodon API Documentation Version 4.0.0 introduced version 2 of the media methods. Version 1 is now deprecated and the new version returns a 202 for larger images. The documentation indicates using GET /api/v1/media/:id to check the status of the attachment when using v2.

A quick fix would be to revert to v1 (see Commit #533) as I was able to send an animated GIF using /api/v1/media/:id

IMG_2457

derspyy commented 4 days ago

would be even better to just let the 202 work the same as a 200, right? the purpose of the v2 endpoint is to let you upload a post without the media having fully processed in the background, the bug here is that 202 is being considered and error when it really isn't.

kernjackson commented 4 days ago

Yes, handling the 202 as a success is definitely the better overall solution.

I'm very new to the project and there's a lot going on in NewPostViewController so please bear with me 🙂. It looks like we're using a modified version of MastodonKit that adds a Result type with success and failure cases. Extending that to handle a pending case would allow us to get the results and then check the status as mentioned in the documentation.

derspyy commented 3 days ago

Yes, handling the 202 as a success is definitely the better overall solution.

I'm very new to the project and there's a lot going on in NewPostViewController so please bear with me 🙂. It looks like we're using a modified version of MastodonKit that adds a Result type with success and failure cases. Extending that to handle a pending case would allow us to get the results and then check the status as mentioned in the documentation.

or maybe start considering every 2XX as success?