The Messenger of Allah ﷺ forbade eating onions and leeks, but need overcame us and we ate some of them. He then said, "Whoever eats from this foul-smelling plant should not come near our mosque, for the angels are offended by what offends humans."
نهى رسول الله ﷺ عن أكل البصل والكراث، فغلبتنا الحاجة فأكلنا منها، فقال: من أكل من هذه الشجرة المنتنة فلا يقربن مسجدنا؛ فإن الملائكة تتأذى مما تتأذى منه الإنس.
Muslim narrated it in "Masjids and Places of Prayer" (564:72), from Abu Bakr bin Abu Shayba, who said, Kathir bin Hisham told us, from Hisham Dastawai, from Abu Zubayr, and he related it.