I decided to avoid special characters and spaces in doc_id, because of working with channels based on IDs is pretty common use case.
On Thursday, January 15, 2015 at 10:30:40 PM UTC+6, Jens Alfke wrote: > > > On Jan 15, 2015, at 3:11 AM, Andrew Tokarev <[email protected] > <javascript:>> wrote: > > I recently found out that custom doc_id is not validated on iOS/Android > (might be true for other platforms). > So it is possible to pass something like: "£%&-7", which causes exception > on SyncGateway (no crash). > > > That is a valid document ID. > > ---- Sync gateway (1.0.0) confused with some doc ids: > ---- > 15:19:44.729250 CRUD+: Invoking sync on > doc "£%&-7" rev 2-d36047fd7682b8f3255a0652ba510790 > 15:19:44.729562 CRUD+: No old revision "£%&-7" / > "1-691feb51f7ea0da0c8e56132396a0451" > 15:19:44.729856 WARNING: Sync fn exception: 400 Illegal channel name > "person-£%&-7"; doc = map[_id:£%&-7 > type:Person _revisions:map[start:%!s(float64=2) > ids:[d36047fd7682b8f3255a0652ba510790 691feb51f7ea0da0c8e56132396a0451]] > _rev:2-d36047fd7682b8f3255a0652ba510790] -- > db.(*Database).getChannelsAndAccess() at crud.go:686 > > > …but that same string is an illegal *channel* ID. Doc and channel IDs are > not the same thing. It can be convenient to name a channel after a > document, but if you do that you need to ensure [on the client] that the > document is given an ID that's a valid channel ID. Or your sync function > could escape characters in the doc ID to make it a valid channel ID. > > —Jens > -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/af706efd-f560-4b10-b9ec-174c2e2fddf1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
