@@ -445,6 +445,8 @@ def add_attachment_from_url(self, url: str):
445445 )
446446 return
447447 except Exception as err :
448+ if isinstance (err , (KeyboardInterrupt , SystemExit )):
449+ raise
448450 log .error (err , exc_info = True )
449451 wx .CallAfter (
450452 wx .MessageBox ,
@@ -476,7 +478,7 @@ def on_show_attachment_details(self, event: wx.CommandEvent):
476478 Args:
477479 event: Event triggered by the show attachment details action
478480 """
479- current_attachment = self .selected_attachment_file ()
481+ current_attachment = self .selected_attachment_file
480482 if not current_attachment :
481483 return
482484
@@ -507,7 +509,7 @@ def on_attachments_remove(self, event: wx.CommandEvent):
507509 event: Event triggered by the remove attachment action
508510 """
509511 selection = self .attachments_list .GetFirstSelected ()
510- current_attachment = self .selected_attachment_file ()
512+ current_attachment = self .selected_attachment_file
511513 if not current_attachment :
512514 return
513515
@@ -530,11 +532,11 @@ def on_copy_attachment_location(self, event: wx.CommandEvent):
530532 Args:
531533 event: Event triggered by the copy attachment location action
532534 """
533- current_attachment = self .selected_attachment_file ()
535+ current_attachment = self .selected_attachment_file
534536 if not current_attachment :
535537 return
536538
537- location = " \" %s \" " % str ( current_attachment .location )
539+ location = f'" { current_attachment .location } "'
538540 with wx .TheClipboard as clipboard :
539541 clipboard .SetData (wx .TextDataObject (location ))
540542
@@ -704,12 +706,21 @@ def resize_all_attachments(self):
704706 for attachment in self .attachment_files :
705707 if not attachment .mime_type .startswith ("image/" ):
706708 continue
707- attachment .resize (
708- self .conv_storage_path ,
709- config .conf ().images .max_width ,
710- config .conf ().images .max_height ,
711- config .conf ().images .quality ,
712- )
709+ try :
710+ attachment .resize (
711+ self .conv_storage_path ,
712+ config .conf ().images .max_width ,
713+ config .conf ().images .max_height ,
714+ config .conf ().images .quality ,
715+ )
716+ except Exception as e :
717+ log .error (
718+ "Error resizing image attachment %s: %s" ,
719+ attachment .location ,
720+ e ,
721+ exc_info = True ,
722+ )
723+ continue
713724
714725 def ensure_model_compatibility (
715726 self , current_model : ProviderAIModel | None
0 commit comments