Return-Path: Delivered-To: apmail-incubator-couchdb-commits-archive@locus.apache.org Received: (qmail 93801 invoked from network); 31 Aug 2008 09:25:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Aug 2008 09:25:36 -0000 Received: (qmail 27512 invoked by uid 500); 31 Aug 2008 09:25:34 -0000 Delivered-To: apmail-incubator-couchdb-commits-archive@incubator.apache.org Received: (qmail 27489 invoked by uid 500); 31 Aug 2008 09:25:34 -0000 Mailing-List: contact couchdb-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-dev@incubator.apache.org Delivered-To: mailing list couchdb-commits@incubator.apache.org Received: (qmail 27480 invoked by uid 99); 31 Aug 2008 09:25:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 Aug 2008 02:25:34 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 Aug 2008 09:24:44 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 59608238896B; Sun, 31 Aug 2008 02:25:15 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r690664 - /incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl Date: Sun, 31 Aug 2008 09:25:15 -0000 To: couchdb-commits@incubator.apache.org From: cmlenz@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080831092515.59608238896B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cmlenz Date: Sun Aug 31 02:25:14 2008 New Revision: 690664 URL: http://svn.apache.org/viewvc?rev=690664&view=rev Log: Fix futon attachment uploading on json_term_changes branch. Modified: incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl Modified: incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl?rev=690664&r1=690663&r2=690664&view=diff ============================================================================== --- incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl (original) +++ incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl Sun Aug 31 02:25:14 2008 @@ -553,6 +553,7 @@ {rev, NewRev} ]}) end; + handle_doc_request(Req, 'GET', _DbName, Db, DocId) -> #doc_query_args{ rev = Rev, @@ -595,16 +596,17 @@ handle_doc_request(Req, 'POST', _DbName, Db, DocId) -> Form = mochiweb_multipart:parse_form(Req), - Rev = proplists:get_value("_rev", Form), - NewAttachments = [{Name, {ContentType, Content}} || - {Name, {ContentType, _}, Content} <- - proplists:get_all_values("_attachments", Form)], - + Rev = list_to_binary(proplists:get_value("_rev", Form)), Doc = case couch_db:open_doc_revs(Db, DocId, [Rev], []) of {ok, [{ok, Doc0}]} -> Doc0#doc{revs=[Rev]}; {ok, [Error]} -> throw(Error) end, + NewAttachments = [ + {list_to_binary(Name), {list_to_binary(ContentType), Content}} || + {Name, {ContentType, _}, Content} <- + proplists:get_all_values("_attachments", Form) + ], #doc{attachments=Attachments} = Doc, NewDoc = Doc#doc{ attachments = Attachments ++ NewAttachments