How can I make CarrierWave add correct extension to filename depending
on its contents? For example, if I upload file "logo" (PNG file
without extension) CarrierWave should save it as "logo.png". And file "img.gif" (JPG file with incorrect extension) respectively should be saved as "img.jpg".