account for folder to upload to in file add preprocess in rest endpoint
@@ -1067,10 +1067,13 @@ class ResourceFileListCreate(ResourceFileToListItemMixin, generics.ListCreateAPI
# I agree that we should not validate and extract metadata as part of the file add api
# Once we have a decision, I will change this implementation accordingly. In that case
# we have to implement additional rest endpoints for file validation and extraction.
+ folder = request.POST.get('folder', None)
try:
hydroshare.utils.resource_file_add_pre_process(resource=resource,
files=[resource_files[0]],
- user=request.user, extract_metadata=True)
+ user=request.user,
+ folder=folder,
+ extract_metadata=True)
except (hydroshare.utils.ResourceFileSizeException,
hydroshare.utils.ResourceFileValidationException, Exception) as ex:
@@ -1078,7 +1081,6 @@ class ResourceFileListCreate(ResourceFileToListItemMixin, generics.ListCreateAPI
raise ValidationError(detail=error_msg)
try:
- folder = request.POST.get('folder', None)
res_file_objects = hydroshare.utils.resource_file_add_process(resource=resource,
files=[resource_files[0]],
user=request.user,
