Don't read file twice in sanitized_file

This can cause excess extra traffic and memory usage when using cache! or directly calling sanitized_file, especially with fog. Also removed what seems to be a useless read in the if block.

I added some specs for the normal case, but the case where file.read returns a File is not tested, because I have no idea how to reproduce that situation. It seems to be related to an old issue #814.