.m4a file import fails with "Unkown Error" when no embedded cover art
Steps to reproduce
- Upload a .m4a file without an embeded coverart image.
What happens?
Import fails during the processing stage with the following error:
{
"source": "upload://01_Shofukan.m4a",
"detail": null,
"error_code": "unknown_error"
}
What is expected?
The file is uploaded and processed correctly.
Context
Funkwhale version(s) affected: Version 0.20.0+git.34ffab27
Installed using the Ansible role and running behind Nginx proxy. Hardware is a Raspberry Pi v4.
I see in the celery logs the following stacktrace:
Oct 15 21:21:58 celery[723]: Traceback (most recent call last):
Oct 15 21:21:58 celery[723]: File "/srv/funkwhale/virtualenv/lib/python3.7/site-packages/celery/app/trace.py", line 385, in trace_task
Oct 15 21:21:58 celery[723]: R = retval = fun(*args, **kwargs)
Oct 15 21:21:58 celery[723]: File "/srv/funkwhale/virtualenv/lib/python3.7/site-packages/celery/app/trace.py", line 648, in __protected_call__
Oct 15 21:21:58 celery[723]: return self.run(*args, **kwargs)
Oct 15 21:21:58 celery[723]: File "/srv/funkwhale/api/funkwhale_api/taskapp/celery.py", line 51, in inner
Oct 15 21:21:58 celery[723]: return function(*args, **kwargs)
Oct 15 21:21:58 celery[723]: File "/srv/funkwhale/api/funkwhale_api/music/tasks.py", line 182, in process_upload
Oct 15 21:21:58 kitezh.lan celery[723]: serializer.is_valid()
Oct 15 21:21:58 celery[723]: File "/srv/funkwhale/virtualenv/lib/python3.7/site-packages/rest_framework/serializers.py", line 235, in is_valid
Oct 15 21:21:58 celery[723]: self._validated_data = self.run_validation(self.initial_data)
Oct 15 21:21:58 celery[723]: File "/srv/funkwhale/virtualenv/lib/python3.7/site-packages/rest_framework/serializers.py", line 430, in run_validation
Oct 15 21:21:58 celery[723]: value = self.to_internal_value(data)
Oct 15 21:21:58 celery[723]: File "/srv/funkwhale/virtualenv/lib/python3.7/site-packages/rest_framework/serializers.py", line 487, in to_internal_value
Oct 15 21:21:58 celery[723]: validated_value = field.run_validation(primitive_value)
Oct 15 21:21:58 celery[723]: File "/srv/funkwhale/virtualenv/lib/python3.7/site-packages/rest_framework/fields.py", line 542, in run_validation
Oct 15 21:21:58 celery[723]: value = self.to_internal_value(data)
Oct 15 21:21:58 celery[723]: File "/srv/funkwhale/api/funkwhale_api/music/metadata.py", line 535, in to_internal_value
Oct 15 21:21:58 celery[723]: return data.get_picture("cover_front", "other")
Oct 15 21:21:58 celery[723]: File "/srv/funkwhale/api/funkwhale_api/music/metadata.py", line 425, in get_picture
Oct 15 21:21:58 celery[723]: pictures = cleaner(pictures)
Oct 15 21:21:58 celery[723]: File "/srv/funkwhale/api/funkwhale_api/music/metadata.py", line 94, in clean_mp4_pictures
Oct 15 21:21:58 celery[723]: for p in list(raw_pictures):
Oct 15 21:21:58 celery[723]: TypeError: 'NoneType' object is not iterable
Uploading the same file with a coverart embedded in it works fine.