cloudhead/cradle — Issue #112: Inconsistent handling of '/' in database name
Author: diversario
Created: 2011-10-23 21:52:07+00:00
State: open

This works:

```javascript
var db = couchdb.database('name%2Fencoded'); // name/encoded

db.get('doc', function(err, doc){
// doc fetched
});
```

This doesn't work:

```javascript
var db = couchdb.database('name/notencoded');

db.get('doc', function(err, doc){
// not_found, missing
});
```
This works:

```javascript
var db = couchdb.database("name/notencoded");
var streamer = db.getAttachment(doc, att_name);
// attachment streams
```

This doesn't work:

```javascript
var db = couchdb.database("name%2Fencoded");
var streamer = db.getAttachment(doc, att_name);
// database not found
```

I ran into this when doing this:

```javascript
var docs = couchdb.database('u' + uid + '%2F' + doctype);

docs.get(item, function(err, file){

if (err) return cb(err);

if (/* access check */)
cb({"error": 403, "reason": 'Insufficient privileges to access this item'});
else {
docs = couchdb.database('u' + req.params.eid + '/' + type);
var streamer = files.getAttachment(item, attachment);
cb(null, streamer);
}
});
```
This construction works.