Someone said, "I used to see a dream and it would make me ill."He said, I met Abu Qatada, who said, "I too used to see a dream and it would make me ill, until I heard the Messenger of Allah ﷺ say, 'A good dream is from Allah. So when one of you sees what he likes, let him not relate it except to someone he loves. And if he sees what he dislikes, let him spit to his left three times and seek refuge with Allah from the evil of Satan and from its evil, and let him not tell anyone about it, for then it will not harm him.'"
إن كنت لأرى الرؤيا تمرضنيي قال: فلقيت أبا قتادة فقال: وأنا كنت لأرى الرؤيا، فتمرضني حتى سمعت رسول الله ﷺ يقول: الرؤيا الصالحة من الله، فإذا رأى أحدكم ما يحب، فلا يحدث بها إلا من يحب، وإن رأى ما يكره، فليتفل عن يساره ثلاثا، وليتعوذ بالله من شر الشيطان، وشرها، ولا يحدث بها أحدا، فإنها لن تضره.
Bukhari narrated it in the Book of Interpretation (744), and Muslim in the Book of Dreams (4:2261), both through the route of Shuba, from Abd Rabbih bin Saeed, from Abu Salama, and he mentioned it.