couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r957653 - in /couchdb/trunk: THANKS share/www/script/test/attachments.js src/couchdb/couch_doc.erl
Date Thu, 24 Jun 2010 17:56:42 GMT
Author: jchris
Date: Thu Jun 24 17:56:41 2010
New Revision: 957653

URL: http://svn.apache.org/viewvc?rev=957653&view=rev
Log:
don't require a revpos attribute for stubs. closes COUCHDB-809 thanks Caleb Land

Modified:
    couchdb/trunk/THANKS
    couchdb/trunk/share/www/script/test/attachments.js
    couchdb/trunk/src/couchdb/couch_doc.erl

Modified: couchdb/trunk/THANKS
URL: http://svn.apache.org/viewvc/couchdb/trunk/THANKS?rev=957653&r1=957652&r2=957653&view=diff
==============================================================================
--- couchdb/trunk/THANKS (original)
+++ couchdb/trunk/THANKS Thu Jun 24 17:56:41 2010
@@ -63,5 +63,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/trunk/share/www/script/test/attachments.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/attachments.js?rev=957653&r1=957652&r2=957653&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/attachments.js (original)
+++ couchdb/trunk/share/www/script/test/attachments.js Thu Jun 24 17:56:41 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/trunk/src/couchdb/couch_doc.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_doc.erl?rev=957653&r1=957652&r2=957653&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_doc.erl (original)
+++ couchdb/trunk/src/couchdb/couch_doc.erl Thu Jun 24 17:56:41 2010
@@ -357,9 +357,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