From bbf258369e626a7957bcf8b445de238013b07898 Mon Sep 17 00:00:00 2001 From: Mike MacDonald Date: Wed, 17 Apr 2013 14:09:43 -0400 Subject: [PATCH] stop making assumptions about pdf-ness --- lib/carrierwave-unoconv/unoconv.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/carrierwave-unoconv/unoconv.rb b/lib/carrierwave-unoconv/unoconv.rb index 8576d76..32510df 100644 --- a/lib/carrierwave-unoconv/unoconv.rb +++ b/lib/carrierwave-unoconv/unoconv.rb @@ -8,7 +8,6 @@ def uno_convert format end def uno_convert format - return if current_path.downcase.ends_with? '.pdf' directory = File.dirname( current_path ) tmpfile = File.join( directory, "tmpfile" ) @@ -16,7 +15,7 @@ def uno_convert format raise CarrierWave::ProcessingError, "UNOconv failed." unless system "unoconv -f #{format} '#{tmpfile}'" - File.rename( File.join(directory, 'tmpfile.pdf'), current_path ) + File.rename( File.join(directory, "tmpfile.#{format}"), current_path ) File.delete( tmpfile ) end