How do I get documents on sync gateway w/ ForestDB id's?

25 views
Skip to first unread message

Traun Leyden

unread,
Jul 11, 2014, 5:04:51 PM7/11/14
to mobile-c...@googlegroups.com

I have a doc in sync gateway with ID !zjZ7kpn3qDr40rK0Q14a~+, and as you can see it shows up on the _changes feed:

$ curl 'http://192.168.212.244:4984/office_radar/_changes' | grep '!zjZ7kpn3qDr40rK0Q14a~+'
,{"seq":1076,"id":"!zjZ7kpn3qDr40rK0Q14a~+","changes":[{"rev":"1-85beb23a141b7eede8255963e688bff8"}]}

If I do a naive curl command, it returns a 404:

{"error":"not_found","reason":"missing"}

But even if I URL encode it, I'm still getting a 404:

{"error":"not_found","reason":"missing"}

Any tips?

Jens Alfke

unread,
Jul 11, 2014, 5:33:25 PM7/11/14
to mobile-c...@googlegroups.com
This looks like a Sync Gateway bug: a “+” in a URL gets interpreted as a space, even if it’s escaped as %2b.

$ http PUT ':4984/db/x%2bx' a=b
HTTP/1.1 201 Created
Content-Length: 65
Content-Type: application/json
Date: Fri, 11 Jul 2014 21:25:38 GMT
Etag: 1-a154bf18a4d64ee6d93b6cc838b2b344
Server: Couchbase Sync Gateway/1.00

{
"id": "x x",
"ok": true,
"rev": "1-a154bf18a4d64ee6d93b6cc838b2b344”
}

It’s probably some weird behavior with Go’s URL parser. I’ll file an issue.

(And I should probably tweak the new doc UUID generator (which isn’t ForestDB specific) to use a URL-safe character set.)

—Jens
Reply all
Reply to author
Forward
0 new messages