diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index 28a59dc..f3ba0ad --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules npm-debug.log test/fixtures/README.md -test/fixtures/not-found.txt \ No newline at end of file +test/fixtures/not-found.txt +.idea \ No newline at end of file diff --git a/lib/cradle/database/index.js b/lib/cradle/database/index.js old mode 100644 new mode 100755 index 9effb77..1d69ebe --- a/lib/cradle/database/index.js +++ b/lib/cradle/database/index.js @@ -5,6 +5,7 @@ var querystring = require('querystring'), var Database = exports.Database = function (name, connection) { this.connection = connection; this.name = encodeURIComponent(name); + this.unEscapedName = name; this.cache = new (cradle.Cache)(connection.options); }; @@ -31,7 +32,7 @@ Database.prototype.exists = function (callback) { Database.prototype.replicate = function (target, options, callback) { if (typeof(options) === 'function') { callback = options, options = {} } - this.connection.replicate(cradle.merge({ source: this.name, target: target }, options), callback); + this.connection.replicate(cradle.merge({ source: this.unEscapedName, target: target }, options), callback); }; Database.prototype.info = function (callback) { diff --git a/lib/cradle/database/views.js b/lib/cradle/database/views.js old mode 100644 new mode 100755 index 9d76e2f..4fef3fe --- a/lib/cradle/database/views.js +++ b/lib/cradle/database/views.js @@ -33,7 +33,7 @@ Database.prototype.fti = function (path, options, callback) { } path = path.split('/'); - path = ['_fti', 'local', this.name, '_design', path[0], path[1]].map(querystring.escape).join('/'); + path = ['_fti', 'local', this.unEscapedName, '_design', path[0], path[1]].map(querystring.escape).join('/'); options = parseOptions(options);