basho/riak_cs — pull request #755 by arekinath (2013-12-12 05:20:18+00:00)
Title: Ignore Owner with an empty ID in AccessControlPolicy blob

Some clients (eg. Cyberduck) are a bit special and can send AccessControlPolicy with an Owner element that has an empty ID element inside, when they are only meant to be updating the ACL. Currently we handle the case where an empty Owner element is sent, but not if it has an empty ID inside it (results in a 500 error at present, due to a badmatch).

I propose that we simply ignore an Owner with an empty element inside, instead of crashing out -- it's what the Amazon S3 seems to do, and it seems vaguely sensible.

For completeness' sake this patch handles any empty child inside the Owner, not just an ID (although I've only ever seen an empty ID sent on its own in the wild so far). It will still crash out in the case that we get an owner with a non-element child or a child with more than one child inside it, which I think is fine for now (as these cases are very clearly malformed).