lib/scribd_fu.rb in mdarby-scribd_fu-2.0.2 vs lib/scribd_fu.rb in mdarby-scribd_fu-2.0.3

- old
+ new

@@ -60,11 +60,11 @@ end # Upload a file to Scribd def upload(obj, file_path) begin - res = scribd_user.upload(:file => "#{file_path}", :access => access_level) + res = scribd_user.upload(:file => escape(file_path), :access => access_level) obj.update_attributes({:ipaper_id => res.doc_id, :ipaper_access_key => res.access_key}) rescue raise ScribdFuUploadError, "Sorry, but #{obj.class} ##{obj.id} could not be uploaded to Scribd" end end @@ -92,9 +92,14 @@ begin @document ||= scribd_user.find_document(id) rescue raise ScribdFuError, "Scribd Document ##{id} not found!" end + end + + # Replace spaces with '%20' (needed by Paperclip models). + def escape(str) + str.gsub(' ', '%20') end end module ClassMethods \ No newline at end of file