@@ -21,7 +21,7 @@ import (
2121func UploadAvatar (ctx context.Context , repo * repo_model.Repository , data []byte ) error {
2222 avatarData , err := avatar .ProcessAvatarImage (data )
2323 if err != nil {
24- return err
24+ return fmt . Errorf ( "UploadAvatar: failed to process repo avatar image: %w" , err )
2525 }
2626
2727 newAvatar := avatar .HashAvatar (repo .ID , data )
@@ -36,19 +36,19 @@ func UploadAvatar(ctx context.Context, repo *repo_model.Repository, data []byte)
3636 // Then repo will be removed - only it avatar file will be removed
3737 repo .Avatar = newAvatar
3838 if err := repo_model .UpdateRepositoryColsNoAutoTime (ctx , repo , "avatar" ); err != nil {
39- return fmt .Errorf ("UploadAvatar: Update repository avatar: %w" , err )
39+ return fmt .Errorf ("UploadAvatar: failed to update repository avatar: %w" , err )
4040 }
4141
4242 if err := storage .SaveFrom (storage .RepoAvatars , repo .CustomAvatarRelativePath (), func (w io.Writer ) error {
4343 _ , err := w .Write (avatarData )
4444 return err
4545 }); err != nil {
46- return fmt .Errorf ("UploadAvatar %s failed: Failed to remove old repo avatar %s: %w" , repo . RelativePath () , newAvatar , err )
46+ return fmt .Errorf ("UploadAvatar: failed to save repo avatar %s: %w" , newAvatar , err )
4747 }
4848
4949 if len (oldAvatarPath ) > 0 {
5050 if err := storage .RepoAvatars .Delete (oldAvatarPath ); err != nil {
51- return fmt .Errorf ("UploadAvatar: Failed to remove old repo avatar %s: %w" , oldAvatarPath , err )
51+ return fmt .Errorf ("UploadAvatar: failed to remove old repo avatar %s: %w" , oldAvatarPath , err )
5252 }
5353 }
5454 return nil
0 commit comments