Permalink
Browse files

Add filename and fileext form Entry#path to Entry#file filename

  • Loading branch information...
Alexander Paramonov
Alexander Paramonov committed Aug 18, 2011
1 parent 468265f commit 504380fa4f0fe4e61481f9dbd8c2ddf10cf327f7
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/dropbox/entry.rb
View
@@ -150,7 +150,10 @@ def file(options={})
throw :not_a_file if directory?
return @cached_file if @cached_file && !options[:force]
- file = Tempfile.new('downloaded', :encoding => "BINARY")
+ ext = ::File.extname(path)
+ name = ::File.basename(path, ext)
+
+ file = Tempfile.new([name, ext], :encoding => "BINARY")
file.write download
file.rewind

0 comments on commit 504380f

Please sign in to comment.