[maps] fix Unable to load layers from WMS capabilities for a specific URL (#123386) (#124216)

* [maps] fix Unable to load layers from WMS spec for a specific URL

* eslint

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit d7bce1c95e)

Co-authored-by: Nathan Reese <reese.nathan@gmail.com>
This commit is contained in:
Kibana Machine 2022-02-01 08:42:38 -05:00 committed by GitHub
parent d511aeca95
commit c5ac8503f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,13 +122,17 @@ function reduceLayers(path, layers) {
const updatedStyles = [...accumulatedCapabilities.styles];
if (_.has(layer, 'Style[0]')) {
updatedStyles.push(
createOption(path, _.get(layer, 'Style[0].Title[0]'), _.get(layer, 'Style[0].Name[0]'))
createOption(
path,
_.get(layer, 'Style[0].Title[0]', ''),
_.get(layer, 'Style[0].Name[0]', '')
)
);
}
return {
layers: [
...accumulatedCapabilities.layers,
createOption(path, layer.Title[0], layer.Name[0]),
createOption(path, _.get(layer, 'Title[0]', ''), _.get(layer, 'Name[0]', '')),
],
styles: updatedStyles,
};