Skip to content

api: Properly handle case when thumbnail can't be generated

For some images - gifs in particular - thumbnails can't be generated by Fractal. In such cases m.extra_content would be None. In attach_message(), however, we unwrapped extra_content assuming it would never be None. This caused a crash when uploading gifs.

This commit makes sure that we handle the case of missing extra_content by making extra_content in attach_file() an Option<ExtraContent>, then setting the thumbnail url appropriately.

Incidentally, this commit also seems to fix an issue where images would show broken thumbnails after a user uploaded them.

Merge request reports