Don't output optional DisplayName if not set. Be a little more explicit
about zeroing other optional fields during xml parsing.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
// DisplayName is optional
if (acl_name)
display_name = acl_name->get_data();
+ else
+ display_name = "";
return true;
}
return false;
permission = *acl_permission;
+ id.clear();
+ name.clear();
+ uri.clear();
+ email.clear();
+
switch (type.get_type()) {
case ACL_TYPE_CANON_USER:
acl_id = (ACLID *)acl_grantee->find_first("ID");
void to_xml(ostream& out) {
if (id.empty())
return;
- out << "<Owner>" <<
- "<ID>" << id << "</ID>" <<
- "<DisplayName>" << display_name << "</DisplayName>" <<
- "</Owner>";
+ out << "<Owner>" << "<ID>" << id << "</ID>";
+ if (!display_name.empty())
+ out << "<DisplayName>" << display_name << "</DisplayName>";
+ out << "</Owner>";
}
void set_id(string& _id) { id = _id; }
void set_name(string& name) { display_name = name; }