add file_path to add file response
@@ -810,9 +810,12 @@ class ResourceFileListCreate(ResourceFileToListItemMixin, generics.ListCreateAPI
error_msg = {'file': 'Adding file to resource failed. %s' % ex.message}
raise ValidationError(detail=error_msg)
+ # prepare response data
+ file_name = os.path.basename(res_file_objects[0].resource_file.name)
+ file_path = res_file_objects[0].resource_file.name.split('/data/contents/')[1]
+ response_data = {'resource_id': pk, 'file_name': file_name, 'file_path': file_path}
resource_modified(resource, request.user, overwrite_bag=False)
- return Response(data=self.resourceFileToListItem(res_file_objects[0]),
- status=status.HTTP_201_CREATED)
+ return Response(data=response_data, status=status.HTTP_201_CREATED)
def _validate_metadata(metadata_list):
