Adding an mp3 file without ID3 tags through manage.py results in an obscure error message
Steps to reproduce
-
wget -O/tmp/foo.mp3 https://matrix.org/_matrix/media/r0/download/mtx.liftm.de/mekqiQXkPXYmlCBjYfBBXTnF
attached: foo -
python -m pudb manage.py import_files -x 8fed5211-d2eb-4bd2-b375-7b07315b3073 /tmp/foo.mp3 --recursive --noinput
What happens?
2020-03-01 13:55:26,721 funkwhale_api.config INFO Running with no plugins
:0: UserWarning: You do not have a working installation of the service_identity module: 'No module named 'service_identity''. Please install it from <https://pypi.python.org/pypi/service_identity> and make sure all of its dependencies are satisfied. Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verification. Many valid certificate/hostname mappings may be rejected.
Import summary:
- 1 files found matching this pattern: ['/tmp/foo.mp3']
- 0 files already found in database
- 1 new files
Selected options: copy music files
For details, please refer to import reference 'cli-2020-03-01T13:55:31.761476+00:00' or URL http://funk.liftm.de/content/libraries/8fed5211-d2eb-4bd2-b375-7b07315b3073/upload?import=cli-2020-03-01T13%3A55%3A31.761476%2B00%3A00
1/1 Importing /tmp/foo.mp3...
Traceback (most recent call last):
File "manage.py", line 20, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/app/funkwhale_api/music/management/commands/import_files.py", line 235, in handle
import_paths, library=library, reference=reference, options=options
File "/app/funkwhale_api/music/management/commands/import_files.py", line 288, in do_import
options["broadcast"],
File "/app/funkwhale_api/music/management/commands/import_files.py", line 330, in create_upload
import_handler(upload_id=upload.pk)
File "/usr/lib/python3.6/site-packages/celery/local.py", line 191, in __call__
return self._get_current_object()(*a, **kw)
File "/usr/lib/python3.6/site-packages/celery/app/task.py", line 394, in __call__
return self.run(*args, **kwargs)
File "/app/funkwhale_api/taskapp/celery.py", line 51, in inner
return function(*args, **kwargs)
File "/app/funkwhale_api/music/tasks.py", line 182, in process_upload
serializer.is_valid()
File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 235, in is_valid
self._validated_data = self.run_validation(self.initial_data)
File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 430, in run_validation
value = self.to_internal_value(data)
File "/usr/lib/python3.6/site-packages/rest_framework/serializers.py", line 485, in to_internal_value
primitive_value = field.get_value(data)
File "/usr/lib/python3.6/site-packages/rest_framework/fields.py", line 435, in get_value
return dictionary.get(self.field_name, empty)
File "/app/funkwhale_api/music/metadata.py", line 359, in get
return self._get_from_self(key)
File "/app/funkwhale_api/music/metadata.py", line 397, in _get_from_self
v = getter(self._file, real_key)
File "/app/funkwhale_api/music/metadata.py", line 41, in get_id3_tag
v = getattr(f.tags[k], attr)
TypeError: 'NoneType' object is not subscriptable
What is expected?
Some meaningful error message. Likely to be output from metadata.py, after checking for some other bogus values than None
.
Context
Funkwhale version(s) affected: 0.20.1 (in docker - happens both with mutagen 1.44.0 and 1.42.0)