jointakahe / takahe

An ActivityPub/Fediverse server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stator has issues with incoming images that have broken or missing focalPoint

rcarmo opened this issue · comments

Here's a log snippet from my test instance, running today's git tip:

orker.1 | Tasks processed this loop:
worker.1 | Running cleaning and scheduling
worker.1 | Attempting transition on users.inboxmessage#987 from state received
worker.1 | Traceback (most recent call last):
worker.1 |   File "/home/piku/.piku/envs/takahe/lib/python3.10/site-packages/asgiref/sync.py", line 486, in thread_handler
worker.1 |     raise exc_info[1]
worker.1 |   File "/home/piku/.piku/apps/takahe/stator/models.py", line 233, in atransition_attempt
worker.1 |     next_state = await current_state.handler(self)  # type: ignore
worker.1 |   File "/home/piku/.piku/apps/takahe/users/models/inbox_message.py", line 30, in handle_received
worker.1 |     await sync_to_async(Post.handle_create_ap)(instance.message)
worker.1 |   File "/home/piku/.piku/envs/takahe/lib/python3.10/site-packages/asgiref/sync.py", line 448, in __call__
worker.1 |     ret = await asyncio.wait_for(future, timeout=None)
worker.1 |   File "/usr/lib/python3.10/asyncio/tasks.py", line 408, in wait_for
worker.1 |     return await fut
worker.1 |   File "/home/piku/.piku/envs/takahe/lib/python3.10/site-packages/asgiref/current_thread_executor.py", line 22, in run
worker.1 |     result = self.fn(*self.args, **self.kwargs)
worker.1 |   File "/home/piku/.piku/envs/takahe/lib/python3.10/site-packages/asgiref/sync.py", line 490, in thread_handler
worker.1 |     return func(*args, **kwargs)
worker.1 |   File "/home/piku/.piku/apps/takahe/activities/models/post.py", line 916, in handle_create_ap
worker.1 |     cls.by_ap(data["object"], create=True, update=True)
worker.1 |   File "/home/piku/.piku/apps/takahe/activities/models/post.py", line 815, in by_ap
worker.1 |     focal_x, focal_y = attachment["focalPoint"]
worker.1 | ValueError: not enough values to unpack (expected 2, got 1)
worker.1 | Traceback (most recent call last):
worker.1 |   File "/home/piku/.piku/apps/takahe/stator/models.py", line 233, in atransition_attempt
worker.1 |     next_state = await current_state.handler(self)  # type: ignore
worker.1 |   File "/home/piku/.piku/apps/takahe/users/models/inbox_message.py", line 30, in handle_received
worker.1 |     await sync_to_async(Post.handle_create_ap)(instance.message)
worker.1 |   File "/home/piku/.piku/envs/takahe/lib/python3.10/site-packages/asgiref/sync.py", line 448, in __call__
worker.1 |     ret = await asyncio.wait_for(future, timeout=None)
worker.1 |   File "/usr/lib/python3.10/asyncio/tasks.py", line 408, in wait_for
worker.1 |     return await fut
worker.1 |   File "/home/piku/.piku/envs/takahe/lib/python3.10/site-packages/asgiref/current_thread_executor.py", line 22, in run
worker.1 |     result = self.fn(*self.args, **self.kwargs)
worker.1 |   File "/home/piku/.piku/envs/takahe/lib/python3.10/site-packages/asgiref/sync.py", line 490, in thread_handler
worker.1 |     return func(*args, **kwargs)
worker.1 |   File "/home/piku/.piku/apps/takahe/activities/models/post.py", line 916, in handle_create_ap
worker.1 |     cls.by_ap(data["object"], create=True, update=True)
worker.1 |   File "/home/piku/.piku/apps/takahe/activities/models/post.py", line 815, in by_ap
worker.1 |     focal_x, focal_y = attachment["focalPoint"]
worker.1 | ValueError: not enough values to unpack (expected 2, got 1)

I went into Django admin and looked at the message, and it had "focalPoint": [0.0] in the JSON data... Looks like a bad default from the poster that somehow got relayed throughout the Fediverse...

I've now found three of these as one of my follows boosts posts from other folks. He is on a Mastodon instance, so I am guessing this may be rather frequent.

Yeah, we should be more tolerant of this if it turns up. I'll get a fix in place.

Thanks! Just pulled your fix, will let you know if anything similar arises.