I am a little bit paranoid about plagiarizing, and I am confused since I have found two seemingly contradictory answers for this.
Suppose source X says "source Y says blah blah blah."
From my google searches, it seems like it is always encouraged to go directly to source Y and cite that. If you do not have access to Y, then you can do a parenthetical citation like this: (Y, as cited in X).
In answers to this question on english.se, people are saying that you must always cite both sources, X and Y. This is because the author of X did the work of finding the relevant source Y, and you must cite this.
What is the correct thing to do?