In the present paper, we consider an inverse source problem for a fractional diffusion equation. This problem is ill-posed, i.e. the solution (if it exists) does not depend continuously on the data. Based on an a priori assumption, we give the optimal error bound analysis and a conditional stability result. Moreover, we use the Fourier regularization method to deal with this problem. An a priori error estimate between the exact solution and its regularized approximation is obtained. Meanwhile, a new a posteriori parameter choice rule is also proposed. For the a priori and the a posteriori regularization parameters choice rules, we all obtain the convergence error estimates which are all order optimal. Numerical examples are presented to illustrate the validity and effectiveness of this method.