You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2010/06/25 16:21:24 UTC
svn commit: r957974 - in /couchdb/branches/0.11.x: THANKS
share/www/script/test/attachments.js src/couchdb/couch_doc.erl
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 <za...@gmail.com>
* Brian Jenkins <bo...@bonkydog.com>
* Paul Bonser <pi...@paulbonser.com>
+ * Caleb Land <ca...@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,