couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r773261 - in /couchdb/branches/0.9.x: ./ etc/default/couchdb share/www/script/test/basics.js src/couchdb/couch_doc.erl
Date Sat, 09 May 2009 19:10:02 GMT
Author: davisp
Date: Sat May  9 19:10:01 2009
New Revision: 773261

URL: http://svn.apache.org/viewvc?rev=773261&view=rev
Log:
Backporting 773260 from trunk.

Fix check for invalid document members.


Modified:
    couchdb/branches/0.9.x/   (props changed)
    couchdb/branches/0.9.x/etc/default/couchdb   (props changed)
    couchdb/branches/0.9.x/share/www/script/test/basics.js
    couchdb/branches/0.9.x/src/couchdb/couch_doc.erl

Propchange: couchdb/branches/0.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat May  9 19:10:01 2009
@@ -1,3 +1,3 @@
 /couchdb/branches/design_resources:751716-751803
 /couchdb/branches/form:729440-730015
-/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373,766505,767398,767543,768573,769109,769127,769804,770782,771472
+/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373,766505,767398,767543,768573,769109,769127,769804,770782,771472,773260

Propchange: couchdb/branches/0.9.x/etc/default/couchdb
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat May  9 19:10:01 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,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373,766505,767398,767543,768573,769109,769127,769804,770782,771472
+/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373,766505,767398,767543,768573,769109,769127,769804,770782,771472,773260
 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440

Modified: couchdb/branches/0.9.x/share/www/script/test/basics.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/share/www/script/test/basics.js?rev=773261&r1=773260&r2=773261&view=diff
==============================================================================
--- couchdb/branches/0.9.x/share/www/script/test/basics.js (original)
+++ couchdb/branches/0.9.x/share/www/script/test/basics.js Sat May  9 19:10:01 2009
@@ -145,4 +145,26 @@
     // deleting a non-existent doc should be 404
     xhr = CouchDB.request("DELETE", "/test_suite_db/doc-does-not-exist");
     T(xhr.status == 404);
+
+  // Check for invalid document members
+  bad_docs = [
+    ["goldfish", {"_zing": 4}],
+    ["zebrafish", {"_zoom": "hello"}],
+    ["mudfish", {"zane": "goldfish", "_fan": "something smells delicious"}],
+    ["tastyfish", {"_bing": {"wha?": "soda can"}}]
+  ]
+  var test_doc = function(info) {
+    var data = JSON.stringify(info[1]);
+    
+    xhr = CouchDB.request("PUT", "/test_suite_db/" + info[0], {body: data});
+    T(xhr.status == 500);
+    result = JSON.parse(xhr.responseText);
+    T(result.error == "doc_validation");
+    
+    xhr = CouchDB.request("POST", "/test_suite_db/", {body: data});
+    T(xhr.status == 500);
+    result = JSON.parse(xhr.responseText);
+    T(result.error == "doc_validation");
   };
+  bad_docs.forEach(test_doc);
+};

Modified: couchdb/branches/0.9.x/src/couchdb/couch_doc.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_doc.erl?rev=773261&r1=773260&r2=773261&view=diff
==============================================================================
--- couchdb/branches/0.9.x/src/couchdb/couch_doc.erl (original)
+++ couchdb/branches/0.9.x/src/couchdb/couch_doc.erl Sat May  9 19:10:01 2009
@@ -212,7 +212,7 @@
     transfer_fields(Rest, Doc);
 
 % unknown special field
-transfer_fields([{<<"_",Name/binary>>, Start} | _], _) when is_integer(Start)
->
+transfer_fields([{<<"_",Name/binary>>, _} | _], _) ->
     throw({doc_validation,
             ?l2b(io_lib:format("Bad special document member: _~s", [Name]))});
             



Mime
View raw message