Fix header for documents with newlines in the name

COUCHDB-708