Skip to content

Commit

Permalink
stop making assumptions about pdf-ness
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike MacDonald committed Apr 17, 2013
1 parent 6bb47dc commit bbf2583
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/carrierwave-unoconv/unoconv.rb
Expand Up @@ -8,15 +8,14 @@ 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" )

File.rename( current_path, tmpfile )

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
Expand Down

0 comments on commit bbf2583

Please sign in to comment.