The Prophet ﷺ saw mucus on the wall of the mosque while he was leading the people in prayer, so he scraped it off. When he finished, he said, "When one of you is in prayer, Allah is before his face, so let none of you spit in front of himself during the prayer."
إن النبي ﷺ رأى نخامة في لمسجد، وهو يصلي بين يدي الناس، فحتها، ثم قال حين انصرف: إن أحدكم إذا كان في الصلاة، فإن الله قبل وجهه، فلا يتنخمن أحد قبل وجهه في الصلاة.
Bukhari narrated it in the Book of Adhan (753) from Qutayba bin Saeed, who said, "Layth narrated to us, from Nafi, from Ibn Umar," and mentioned something similar. He said, "Musa bin Uqba and Ibn Abu Rawad also narrated it from Nafi."I say, the основа of the hadith is found in the Sahihayn and in Muwatta Malik, as mentioned before, except that none of them mentioned his statement, "while he was praying." This will be discussed in detail in the chapters on mosques.As for his statement, "Musa bin Uqba narrated it," Muslim connected it (51/547), and he too did not mention "while he was praying."As for his statement, "Ibn Abu Rawad narrated it," Ahmad connected it (4908), and it states explicitly that the scratching occurred after finishing the prayer. So perhaps by citing this corroborating narration he intended only the основа of the hadith.For more, see the Book of Mosques.