You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by cm...@apache.org on 2008/08/31 11:25:15 UTC
svn commit: r690664 -
/incubator/couchdb/branches/json_term_changes/src/couchdb/couch_httpd.erl
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