To avoid getting them, store the bananas in the fridge. I pull out 1 or 2 a day to let them get to room temp before eating. The peels I put in a little compostable bag which ends up in the compost bin. Bonus is the bananas last longer too. The problem is when you leave the peels in an unsealed trashbag for days. If you do have the flies, that vinegar dish mentioned in the OP should take care of most of them.