PouchDB, sync-gateway failure with attachments

I am using PouchDB to display information from a Couchbase Server. In the future I want to be able to edit the information, but for now it is simply a data display format. I am using Node.js with PouchDB

The data is provided from an app using Couchbase Lite which pushes information through the Sync Gateway 2.1 (also tried on Sync Gateway 2.5)

I am simply replicating the Couchbase Server to the PouchDB and doing all of my operations from there. This has been working really well, however I just added the ability to add a photo on the app and now the replication is failing because it can’t retrieve the attachment.

You are probably thinking that this sounds like a PouchDB issue, however the issue actually stems from this issue:

Where PouchDB is requested the URL with “/” which for whatever reason Sync Gateway doesn’t recognise when retrieving attachments.
I can confirm this behaviour in a browser, where if I type in
http://localhost:4984/db/id/blob_/image
I get a 404
But
http://localhost:4984/db/id/blob_%2Fimage
Returns the image correct.

Is there any way that I can get sync gateway to just treat the forward slashes correctly? The solution to use %2F is pretty clunky.

Sync Gateway is treating forward slashes in URIs correctly by expecting it to be URL encoded as per w3c recommendations. This is a standard treatment of reserved characters in URIs.