Update event_service and account_service URI
Use boost::urls::format. Boost::urls::format allows escaping URLs
properly, and has been deployed in most places. This now includes
users in that set.
Tested: Inspection only.
Change-Id: Ib16c8fceb7c58f4074f65df7634ac91af0633e2b
Signed-off-by: Willy Tu <wltu@google.com>
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 9a45404..c89073b 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -1749,8 +1749,8 @@
if (userCanSeeAllAccounts || (thisUser == user && userCanSeeSelf))
{
nlohmann::json::object_t member;
- member["@odata.id"] = "/redfish/v1/AccountService/Accounts/" +
- user;
+ member["@odata.id"] = boost::urls::format(
+ "/redfish/v1/AccountService/Accounts/{}", user);
memberArray.emplace_back(std::move(member));
}
}
@@ -2086,8 +2086,8 @@
nlohmann::json& roleEntry =
asyncResp->res.jsonValue["Links"]["Role"];
- roleEntry["@odata.id"] =
- "/redfish/v1/AccountService/Roles/" + role;
+ roleEntry["@odata.id"] = boost::urls::format(
+ "/redfish/v1/AccountService/Roles/{}", role);
}
else if (property.first == "UserPasswordExpired")
{
@@ -2126,8 +2126,8 @@
}
}
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/AccountService/Accounts/" + accountName;
+ asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
+ "/redfish/v1/AccountService/Accounts/{}", accountName);
asyncResp->res.jsonValue["Id"] = accountName;
asyncResp->res.jsonValue["UserName"] = accountName;
});
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
index 30103ba..2c2fd5d 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -644,8 +644,8 @@
asyncResp->res.jsonValue["@odata.type"] =
"#EventDestination.v1_8_0.EventDestination";
asyncResp->res.jsonValue["Protocol"] = "Redfish";
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/EventService/Subscriptions/" + id;
+ asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
+ "/redfish/v1/EventService/Subscriptions/{}", id);
asyncResp->res.jsonValue["Id"] = id;
asyncResp->res.jsonValue["Name"] = "Event Destination " + id;
asyncResp->res.jsonValue["Destination"] = subValue->destinationUrl;