From a7ee95b33cecb4320af49469e26390b12ea8c54a Mon Sep 17 00:00:00 2001 From: "Johannes J. Schmidt" Date: Fri, 29 Jan 2010 20:00:06 +0100 Subject: [PATCH] fixed extended attachment encoding part 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit encoding was done twice, once while setting attachment and once while saving the document. Also the attachment was decoded while retreaving, but this is done by CouchDB itself automatically, as described in http://wiki.apache.org/couchdb/HTTP_Document_API#line-463. Signed-off-by: Marcos Tapajós --- lib/couchrest/mixins/extended_attachments.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/couchrest/mixins/extended_attachments.rb b/lib/couchrest/mixins/extended_attachments.rb index e81670b..5b5e2b8 100644 --- a/lib/couchrest/mixins/extended_attachments.rb +++ b/lib/couchrest/mixins/extended_attachments.rb @@ -14,7 +14,7 @@ module CouchRest # reads the data from an attachment def read_attachment(attachment_name) - Base64.decode64(database.fetch_attachment(self, attachment_name)) + database.fetch_attachment(self, attachment_name) end # modifies a file attachment on the current doc @@ -52,10 +52,6 @@ module CouchRest private - def encode_attachment(data) - ::Base64.encode64(data).gsub(/\r|\n/,'') - end - def get_mime_type(file) ::MIME::Types.type_for(file.path).empty? ? 'text\/plain' : MIME::Types.type_for(file.path).first.content_type.gsub(/\//,'\/')