@@ -682,6 +682,8 @@ def execute(self):
682682 folder_id = self ._folder .uuid ,
683683 images = [image .name for image in self ._attachments ],
684684 )
685+ if isinstance (response , dict ) and "error" in response :
686+ raise AppException (response ["error" ])
685687 duplications = [image ["name" ] for image in response ]
686688 meta = {}
687689 to_upload = []
@@ -4303,6 +4305,16 @@ def exclude_file_patterns(self):
43034305 return constances .DEFAULT_FILE_EXCLUDE_PATTERNS
43044306 return self ._exclude_file_patterns
43054307
4308+ def validate_annotation_status (self ):
4309+ if self ._annotation_status and self ._annotation_status .lower () not in constances .AnnotationStatus .values ():
4310+ raise AppValidationException ("Invalid annotations status" )
4311+
4312+ def validate_extensions (self ):
4313+ if self ._extensions and not all (
4314+ [extension in constances .DEFAULT_IMAGE_EXTENSIONS for extension in self ._extensions ]
4315+ ):
4316+ raise AppValidationException ("" )
4317+
43064318 def validate_project_type (self ):
43074319 if self ._project .project_type == constances .ProjectType .VIDEO .value :
43084320 raise AppValidationException (
@@ -4511,7 +4523,7 @@ def execute(self) -> Response:
45114523
45124524 if self ._folder .name == "root" and not self ._image_names :
45134525 response = self ._backend_service .delete_image_annotations (
4514- project_id = self ._project .uuid , team_id = self ._project .team_id ,
4526+ project_id = self ._project .uuid , team_id = self ._project .team_id , image_names = self . _image_names
45154527 )
45164528 else :
45174529 response = self ._backend_service .delete_image_annotations (
@@ -4540,7 +4552,7 @@ def execute(self) -> Response:
45404552 logger .info ("Annotations deleted" )
45414553 break
45424554 else :
4543- self ._response .errors = AppException ("Invalid image names." )
4555+ self ._response .errors = AppException ("Invalid image names or empty folder ." )
45444556 return self ._response
45454557
45464558
0 commit comments