scidsg / mastodon-scheduler

A self-hosted app to schedule your posts to Mastodon 🐘.
https://mastodon-scheduler.app
GNU Affero General Public License v3.0
34 stars 1 forks source link

Uploading a 2MB animated GIF fails #73

Open fastjack opened 6 months ago

fastjack commented 6 months ago

I was trying to schedule a post with an animated GIF. The image is 2MB. When clicked on the "Toot!" button I received an internal server error in the browser. The output of the flask application showed this:

2024-03-29 17:10:55 [2024-03-29 16:10:55,141] ERROR in app: Exception on / [POST]
2024-03-29 17:10:55 Traceback (most recent call last):
2024-03-29 17:10:55   File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1463, in wsgi_app
2024-03-29 17:10:55     response = self.full_dispatch_request()
2024-03-29 17:10:55   File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 872, in full_dispatch_request
2024-03-29 17:10:55     rv = self.handle_user_exception(e)
2024-03-29 17:10:55   File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 870, in full_dispatch_request
2024-03-29 17:10:55     rv = self.dispatch_request()
2024-03-29 17:10:55   File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 855, in dispatch_request
2024-03-29 17:10:55     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
2024-03-29 17:10:55   File "/app/app.py", line 74, in index
2024-03-29 17:10:55     mastodon.status_post(status=content, spoiler_text=content_warning, media_ids=[media_id] if media_id else None, scheduled_at=utc_datetime)
2024-03-29 17:10:55   File "/usr/local/lib/python3.10/site-packages/decorator.py", line 232, in fun
2024-03-29 17:10:55     return caller(func, *(extras + args), **kw)
2024-03-29 17:10:55   File "/usr/local/lib/python3.10/site-packages/mastodon/utility.py", line 49, in wrapper
2024-03-29 17:10:55     return function(self, *args, **kwargs)
2024-03-29 17:10:55   File "/usr/local/lib/python3.10/site-packages/mastodon/statuses.py", line 248, in status_post
2024-03-29 17:10:55     return self.__status_internal(
2024-03-29 17:10:55   File "/usr/local/lib/python3.10/site-packages/mastodon/statuses.py", line 182, in __status_internal
2024-03-29 17:10:55     return self.__api_request('POST', '/api/v1/statuses', params, headers=headers, use_json=use_json)
2024-03-29 17:10:55   File "/usr/local/lib/python3.10/site-packages/mastodon/internals.py", line 297, in __api_request
2024-03-29 17:10:55     raise ex_type('Mastodon API returned error', response_object.status_code, response_object.reason, error_msg)
2024-03-29 17:10:55 mastodon.errors.MastodonAPIError: ('Mastodon API returned error', 422, 'Unknown Error', 'Cannot attach files that have not finished processing. Try again in a moment!')
2024-03-29 17:10:55 192.168.65.1 - - [29/Mar/2024 16:10:55] "POST / HTTP/1.1" 500 -

Steps to reproduce the behavior:

  1. Enter any text into "What's on Your Mind?"
  2. Add a (animated) GIF image >= 2MB
  3. Choose any date in "Schedule Post"
  4. Click "Toot!"