Author: kocolosk
Date: Wed May 13 14:43:39 2009
New Revision: 774384

URL: http://svn.apache.org/viewvc?rev=774384&view=rev
Log:
merged r771480 from trunk

Modified:
    couchdb/branches/0.9.x/   (props changed)
    couchdb/branches/0.9.x/etc/default/couchdb   (props changed)
    couchdb/branches/0.9.x/src/couchdb/couch_rep.erl

Propchange: couchdb/branches/0.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 13 14:43:39 2009
@@ -1,3 +1,3 @@
 /couchdb/branches/design_resources:751716-751803
 /couchdb/branches/form:729440-730015
-/couchdb/trunk:758717,758723,758768,758942,759588,760442,760503,760532-760533,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,762019,762153,762574,763816,763818,763833,764257,764835,765419-765420,765479,765819,766340,766347,766353,766358,766373,766383,766390,766392,766399,766406-766407,766456,766467,766476,766493,766505-766506,766751,766767,767164,767175-767176,767190,767204,767206,767208,767362,767398,767506,767543,768573,769109,769127,769181,769211,769792,769804,770782,771418,771466-771467,771472,772406,772415,772978,773225,773260,773319,773387,773401,774045,774095,774101,774180-774181
+/couchdb/trunk:758717,758723,758768,758942,759588,760442,760503,760532-760533,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,762019,762153,762574,763816,763818,763833,764257,764835,765419-765420,765479,765819,766340,766347,766353,766358,766373,766383,766390,766392,766399,766406-766407,766456,766467,766476,766493,766505-766506,766751,766767,767164,767175-767176,767190,767204,767206,767208,767362,767398,767506,767543,768573,769109,769127,769181,769211,769792,769804,770782,771418,771466-771467,771472,771480,772406,772415,772978,773225,773260,773319,773387,773401,774045,774095,774101,774180-774181

Propchange: couchdb/branches/0.9.x/etc/default/couchdb
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 13 14:43:39 2009
@@ -1,4 +1,4 @@
 /couchdb/branches/design_resources/etc/default/couchdb:751716-751803
 /couchdb/branches/form/etc/default/couchdb:729440-730015
-/couchdb/trunk/etc/default/couchdb:758717,758723,758768,758942,759588,760442,760503,760532-760533,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,762019,762153,762574,763816,763818,763833,764257,764835,765419-765420,765479,765819,766340,766347,766353,766358,766373,766383,766390,766392,766399,766406-766407,766456,766467,766476,766493,766505-766506,766751,766767,767164,767175-767176,767190,767204,767206,767208,767362,767398,767506,767543,768573,769109,769127,769181,769211,769792,769804,770782,771418,771466-771467,771472,772406,772415,772978,773225,773260,773319,773387,773401,774045,774095,774101,774180-774181
+/couchdb/trunk/etc/default/couchdb:758717,758723,758768,758942,759588,760442,760503,760532-760533,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,762019,762153,762574,763816,763818,763833,764257,764835,765419-765420,765479,765819,766340,766347,766353,766358,766373,766383,766390,766392,766399,766406-766407,766456,766467,766476,766493,766505-766506,766751,766767,767164,767175-767176,767190,767204,767206,767208,767362,767398,767506,767543,768573,769109,769127,769181,769211,769792,769804,770782,771418,771466-771467,771472,771480,772406,772415,772978,773225,773260,773319,773387,773401,774045,774095,774101,774180-774181
 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440

Modified: couchdb/branches/0.9.x/src/couchdb/couch_rep.erl
URL: 
http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_rep.erl?rev=774384&r1=774383&r2=774384&view=diff
==============================================================================
--- couchdb/branches/0.9.x/src/couchdb/couch_rep.erl (original)
+++ couchdb/branches/0.9.x/src/couchdb/couch_rep.erl Wed May 13 14:43:39 2009
@@ -369,10 +369,11 @@
         {ibrowse_async_response_end, ReqId} -> ok
     end.
 
-attachment_stub_converter(DbS, Id, {Name, {stub, Type, Length}}) ->
+attachment_stub_converter(DbS, Id, Rev, {Name, {stub, Type, Length}}) ->
     #http_db{uri=DbUrl, headers=Headers} = DbS,
-    % TODO worry about revisions
-    Url = DbUrl ++ url_encode(Id) ++ "/" ++ url_encode(?b2l(Name)),
+    {Pos, [RevId|_]} = Rev,
+    Url = lists:flatten([DbUrl, url_encode(Id), "/", url_encode(?b2l(Name)),
+        "?rev=", couch_doc:rev_to_str({Pos,RevId})]),
     ?LOG_DEBUG("Attachment URL ~p", [Url]),
     {ok, RcvFun} = make_attachment_stub_receiver(Url, Headers, Name, 
         Type, Length),
@@ -712,8 +713,9 @@
         fun({[{<<"missing">>, Rev}]}) ->
             {{not_found, missing}, couch_doc:parse_rev(Rev)};
         ({[{<<"ok">>, JsonDoc}]}) ->
-        #doc{id=Id, attachments=Attach} = Doc = 
couch_doc:from_json_obj(JsonDoc),
-        Attach2 = [attachment_stub_converter(DbS,Id,A) || A <- Attach],
+        #doc{id=Id, revs=Rev, attachments=Attach} = Doc =
+            couch_doc:from_json_obj(JsonDoc),
+        Attach2 = [attachment_stub_converter(DbS,Id,Rev,A) || A <- Attach],
         {ok, Doc#doc{attachments=Attach2}}
         end, JsonResults),
     {ok, Results};


Reply via email to