Skip to content

Commit

Permalink
(pouchdb#7830) - Don't require an opaque string in the rev
Browse files Browse the repository at this point in the history
* Don't require an opaque string in the rev

This now matches the same regular expression in packages/node_modules/pouchdb-core/src/adapter.js, line 584

* Add a test that this patch fixes
  • Loading branch information
flimzy authored and sto3psl committed Mar 10, 2021
1 parent 1fcac5d commit 9992954
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var dataWords = toObject([
]);

function parseRevisionInfo(rev) {
if (!/^\d+-./.test(rev)) {
if (!/^\d+-/.test(rev)) {
return createError(INVALID_REV);
}
var idx = rev.indexOf('-');
Expand Down
15 changes: 15 additions & 0 deletions tests/integration/test.bulk_docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,21 @@ adapters.forEach(function (adapter) {
});
});

it("7829 bare rev 1- with new_edits=false", function (done) {
var db = new PouchDB(dbs.name);
var docs = [
{
_id: "foo",
_rev: "1-",
integer: 1
}
];
db.bulkDocs({ docs: docs }, { new_edits: false }, function (err) {
should.not.exist(err, 'no error');
done();
});
});

it('Test empty bulkDocs', function () {
var db = new PouchDB(dbs.name);
return db.bulkDocs([]);
Expand Down

0 comments on commit 9992954

Please sign in to comment.