couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r957974 - in /couchdb/branches/0.11.x: THANKS share/www/script/test/attachments.js src/couchdb/couch_doc.erl
Date Fri, 25 Jun 2010 14:21:24 GMT
Author: jan
Date: Fri Jun 25 14:21:23 2010
New Revision: 957974

URL: http://svn.apache.org/viewvc?rev=957974&view=rev
Log:
Merge r957653 from trunk:

don't require a revpos attribute for stubs. closes COUCHDB-809 thanks Caleb Land

Modified:
    couchdb/branches/0.11.x/THANKS
    couchdb/branches/0.11.x/share/www/script/test/attachments.js
    couchdb/branches/0.11.x/src/couchdb/couch_doc.erl

Modified: couchdb/branches/0.11.x/THANKS
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/THANKS?rev=957974&r1=957973&r2=957974&view=diff
==============================================================================
--- couchdb/branches/0.11.x/THANKS (original)
+++ couchdb/branches/0.11.x/THANKS Fri Jun 25 14:21:23 2010
@@ -60,5 +60,6 @@ suggesting improvements or submitting ch
  * Zachary Zolton <zachary.zolton@gmail.com>
  * Brian Jenkins <bonkydog@bonkydog.com>
  * Paul Bonser <pib@paulbonser.com>
+ * Caleb Land <caleb.land@gmail.com>
 
 For a list of authors see the `AUTHORS` file.

Modified: couchdb/branches/0.11.x/share/www/script/test/attachments.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/share/www/script/test/attachments.js?rev=957974&r1=957973&r2=957974&view=diff
==============================================================================
--- couchdb/branches/0.11.x/share/www/script/test/attachments.js (original)
+++ couchdb/branches/0.11.x/share/www/script/test/attachments.js Fri Jun 25 14:21:23 2010
@@ -244,4 +244,24 @@ couchTests.attachments= function(debug) 
     body: "THIS IS AN ATTACHMENT. BOOYA!"
   });
   TEquals(400, xhr.status, "should return error code 400 Bad Request");
+
+  // test COUCHDB-809 - stubs should only require the 'stub' field
+  var bin_doc6 = {
+    _id: "bin_doc6",
+    _attachments:{
+      "foo.txt": {
+        content_type:"text/plain",
+        data: "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ="
+      }
+    }
+  }
+  var save_response = db.save(bin_doc6);
+  bin_doc6._rev = save_response["rev"];
+  // stub out the attachment
+  bin_doc6._attachments["foo.txt"] = { stub: true };
+
+  var xhr = CouchDB.request("PUT", "/test_suite_db/bin_doc6", {
+    body: JSON.stringify(bin_doc6)
+  });
+  TEquals(201, xhr.status, "should send 201 Created when attachment stub contains only the
'stub' field");
 };

Modified: couchdb/branches/0.11.x/src/couchdb/couch_doc.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_doc.erl?rev=957974&r1=957973&r2=957974&view=diff
==============================================================================
--- couchdb/branches/0.11.x/src/couchdb/couch_doc.erl (original)
+++ couchdb/branches/0.11.x/src/couchdb/couch_doc.erl Fri Jun 25 14:21:23 2010
@@ -355,9 +355,9 @@ has_stubs([_Att|Rest]) ->
 merge_stubs(#doc{id=Id,atts=MemBins}=StubsDoc, #doc{atts=DiskBins}) ->
     BinDict = dict:from_list([{Name, Att} || #att{name=Name}=Att <- DiskBins]),
     MergedBins = lists:map(
-        fun(#att{name=Name, data=stub, revpos=RevPos}) ->
+        fun(#att{name=Name, data=stub}) ->
             case dict:find(Name, BinDict) of
-            {ok, #att{revpos=RevPos}=DiskAtt} ->
+            {ok, #att{}=DiskAtt} ->
                 DiskAtt;
             _ ->
                 throw({missing_stub,



Mime
View raw message