cloudhead/cradle — Issue #117: getAttachment() shouldn't escape docId
Author: sgmentzer
Created: 2011-11-12 07:31:12+00:00
State: open

By convention design document IDs are prefixed with `_design/`. Apparently CouchDb doesn't handle escaping it, e.g. `_design%2Fapp`, and attempting to retrieve a design doc attachment using such an ID returns a zero-length attachment (and no error). Tested with CouchDb 1.1.1.

So in getAttachment():

```pathname = '/' + [name, docId, attachmentName].map(querystring.escape).join('/');```

should be

```pathname = '/' + [name, docId, querystring.escape(attachmentName)].join('/');```