stencila/hub

API: GET /projects/{project}/files/ returns a 500 error

alex-ketch opened this issue · 0 comments

While attempting to retrieve the list of files for a project, the latest version of the Hub (deployed and local) returns the following 500 error:

{
  message: "'int' object has no attribute 'id'",
  traceback: `Traceback (most recent call last):
File \"/hub/manager/venv/lib/python3.7/site-packages/rest_framework/views.py\", line 506, in dispatch
  response = handler(request, *args, **kwargs)
File \"/hub/manager/manager/api/helpers.py\", line 120, in list
  return self.get_paginated_response(serializer.data)
File \"/hub/manager/venv/lib/python3.7/site-packages/rest_framework/serializers.py\", line 745, in data
  ret = super().data
File \"/hub/manager/venv/lib/python3.7/site-packages/rest_framework/serializers.py\", line 246, in data
  self._data = self.to_representation(self.instance)
File \"/hub/manager/venv/lib/python3.7/site-packages/rest_framework/serializers.py\", line 664, in to_representation
  self.child.to_representation(item) for item in iterable
File \"/hub/manager/venv/lib/python3.7/site-packages/rest_framework/serializers.py\", line 664, in <listcomp>
  self.child.to_representation(item) for item in iterable
File \"/hub/manager/venv/lib/python3.7/site-packages/rest_framework/serializers.py\", line 515, in to_representation
  ret[field.field_name] = field.to_representation(attribute)
File \"/hub/manager/venv/lib/python3.7/site-packages/rest_framework/fields.py\", line 1870, in to_representation
  return method(value)
File \"/hub/manager/projects/api/serializers.py\", line 603, in get_source
  return [source.id for source in obj[\"source\"]]
File \"/hub/manager/projects/api/serializers.py\", line 603, in <listcomp>
  return [source.id for source in obj[\"source\"]]\nAttributeError: 'int' object has no attribute 'id'`,
}