I believe this should fix the slice bug. It checks the length and the limit before slicing the array. If the versions length is below the limit it ends the action. If it is above the limit it slices the versions array. Then the versionsToDelete will always have a minimum of 1 entry if it passes the length check.
I believe this should fix the slice bug. It checks the length and the limit before slicing the array. If the versions length is below the limit it ends the action. If it is above the limit it slices the versions array. Then the
versionsToDelete
will always have a minimum of 1 entry if it passes the length check.