This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Closed
Description
Description
We've recently noticed that uploads to _matrix/media/r0/upload
always cause an error when one of the images dimensions is only at one pixel.
Steps to reproduce
- create a file that has one dimension of one pixel
- upload it to synapse (
_matrix/media/r0/upload
)
2021-08-31 08:49:51,833 - synapse.http.server - 97 - ERROR - POST-66 - Failed handle request via 'UploadResource': <XForwardedForRequest at 0x7f9a6b2284a8 method='POST' uri='/_matrix/media/r0/upload?filename=bla.png&access_token=<redacted>' clientproto='HTTP/1.0' site='8008'>
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/synapse/http/server.py", line 258, in _async_render_wrapper
callback_return = await self._async_render(request)
File "/usr/local/lib/python3.7/dist-packages/synapse/http/server.py", line 286, in _async_render
callback_return = await raw_callback_return
File "/usr/local/lib/python3.7/dist-packages/synapse/rest/media/v1/upload_resource.py", line 94, in _async_render_POST
media_type, upload_name, content, content_length, requester.user
File "/usr/local/lib/python3.7/dist-packages/synapse/rest/media/v1/media_repository.py", line 182, in create_content
await self._generate_thumbnails(None, media_id, media_id, media_type)
File "/usr/local/lib/python3.7/dist-packages/synapse/rest/media/v1/media_repository.py", line 733, in _generate_thumbnails
self.hs.get_reactor(), thumbnailer.scale, t_width, t_height, t_type
File "/usr/local/lib/python3.7/dist-packages/twisted/python/threadpool.py", line 238, in inContext
result = inContext.theWork() # type: ignore[attr-defined]
File "/usr/local/lib/python3.7/dist-packages/twisted/python/threadpool.py", line 255, in <lambda>
ctx, func, *args, **kw
File "/usr/local/lib/python3.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python3.7/dist-packages/twisted/python/context.py", line 83, in callWithContext
return func(*args, **kw)
File "/usr/local/lib/python3.7/dist-packages/synapse/logging/context.py", line 902, in g
return f(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/synapse/rest/media/v1/thumbnailer.py", line 123, in scale
scaled = self._resize(width, height)
File "/usr/local/lib/python3.7/dist-packages/synapse/rest/media/v1/thumbnailer.py", line 115, in _resize
return self.image.resize((width, height), Image.ANTIALIAS)
File "/usr/local/lib/python3.7/dist-packages/PIL/Image.py", line 2001, in resize
return self._new(self.im.resize(size, resample, box))
ValueError: height and width must be > 0
Version information
We are currently using version 1.41.0 in a docker container running debian:10-slim.
The installation ist done via pip.