managers: fix bug of searching dbus object path

Notice a bug of patching existed object if the object name contains
space or underscore.

Normally dbus replace space with underscore for object path.
Replacing all spaces in input name with underscore to find the correct
dbus object path.

Tested results:

- Add new object
Input JSON
```
{
    "Oem": {
        "OpenBmc": {
            "Fan": {
                "StepwiseControllers": {
                    "Test_1": {
                        "Direction": "Floor",
                        "Inputs": [
                            "MB_U402_THERM_LOCAL"
                        ],
                        "NegativeHysteresis": 0.0,
                        "PositiveHysteresis": 0.0,
                        "Steps": [
                            {
                                "Output": 0.0,
                                "Target": 48.0
                            },
                            {
                                "Output": 40.0,
                                "Target": 52.0
                            }
                        ],
                        "Zones": [
                            {
                                "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0"
                            }
                        ]
                    }
                }
            }
        }
    }
}
```

Check result from /redfish/v1/Managers/bmc
```
"Test_1": {
    "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/StepwiseControllers/Test_1",
    "@odata.type": "#OemManager.StepwiseController",
    "Direction": "Floor",
    "Inputs": [
        "MB U402 THERM LOCAL"
    ],
    "NegativeHysteresis": 0.0,
    "PositiveHysteresis": 0.0,
    "Steps": [
        {
            "Output": 0.0,
            "Target": 48.0
        },
        {
            "Output": 40.0,
            "Target": 52.0
        }
    ],
    "Zones": [
        {
            "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0"
        }
    ]
}
```

- Patching existed object successful
Input JSON
```
{
    "Oem": {
        "OpenBmc": {
            "Fan": {
                "StepwiseControllers": {
                    "Test_1": {
                        "NegativeHysteresis": 0.0,
                        "PositiveHysteresis": 5.0,
                    }
                }
            }
        }
    }
}
```

Check result from /redfish/v1/Managers/bmc
```
"Test_1": {
    "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/StepwiseControllers/Test_1",
    "@odata.type": "#OemManager.StepwiseController",
    "Direction": "Floor",
    "Inputs": [
        "MB U402 THERM LOCAL"
    ],
    "NegativeHysteresis": 0.0,
    "PositiveHysteresis": 5.0,
    "Steps": [
        {
            "Output": 0.0,
            "Target": 48.0
        },
        {
            "Output": 40.0,
            "Target": 52.0
        }
    ],
    "Zones": [
        {
            "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0"
        }
    ]
}
```

Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I12c78e52801bd0814ba2d928cf020e0a04214c39
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index ba63dc4..6e1427b 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -1504,13 +1504,15 @@
                  it != container->end(); ++it)
             {
                 const auto& name = it.key();
+                std::string dbusObjName = name;
+                std::replace(dbusObjName.begin(), dbusObjName.end(), ' ', '_');
                 BMCWEB_LOG_DEBUG << "looking for " << name;
 
                 auto pathItr =
                     std::find_if(managedObj.begin(), managedObj.end(),
-                                 [&name](const auto& obj) {
+                                 [&dbusObjName](const auto& obj) {
                     return boost::algorithm::ends_with(obj.first.str,
-                                                       "/" + name);
+                                                       "/" + dbusObjName);
                     });
                 dbus::utility::DBusPropertiesMap output;