delete aggregations on overwrite
@@ -996,8 +996,20 @@ def unzip_file(user, res_id, zip_with_rel_path, bool_remove_original,
for file in res_files:
destination_file = _get_destination_filename(file.name, unzipped_foldername)
if istorage.exists(destination_file):
+ if resource.resource_type == "CompositeResource":
+ aggregation_object = resource.get_file_aggregation_object(
+ destination_file)
+ if aggregation_object:
+ aggregation_object.logical_delete(user)
+ else:
+ logger.error("No aggregation object found for " + destination_file)
+ istorage.delete(destination_file)
+ else:
istorage.delete(destination_file)
- istorage.moveFile(file.name, destination_file)
+ # now move each file to the destination
+ for file in unzipped_files:
+ destination_file = _get_destination_filename(file, unzipped_foldername)
+ istorage.moveFile(file, destination_file)
# and now link them to the resource
added_resource_files = []
for file in res_files:
