stencila/hub

File.MultipleObjectsReturned: get() returned more than one File -- it returned 2!

sentry-io opened this issue · 0 comments

Should gracefully handle more than one current file with path (even though that should not happen).

Sentry Issue: HUB-14F

File.MultipleObjectsReturned: get() returned more than one File -- it returned 2!
(3 additional frame(s) were not displayed)
...
  File "rest_framework/serializers.py", line 200, in save
    self.instance = self.update(self.instance, validated_data)
  File "projects/api/serializers.py", line 494, in update
    project.set_image_from_file(image_path)
  File "projects/models/projects.py", line 222, in set_image_from_file
    file = self.files.get(current=True, path=file)
  File "django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "django/db/models/query.py", line 433, in get
    raise self.model.MultipleObjectsReturned(