Skip to content

Commit

Permalink
[Sitemap UI] Do not break format defined in label with extra spaces (#…
Browse files Browse the repository at this point in the history
…3708)

Fix openhab/openhab-webui#1953

Fix a regression introduced by PR #3644

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
  • Loading branch information
lolodomo authored Jul 17, 2023
1 parent 66dec25 commit f711373
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,8 @@ private QuantityType<?> convertStateToWidgetUnit(QuantityType<?> quantityState,
"Item '{}' with unit, nothing allowed after unit in label pattern '{}', dropping postfix",
itemName, pattern);
}
pattern = pattern.substring(0, matcherEnd) + (!unit.isBlank() ? " " + unit : "");
pattern = unit.isBlank() ? pattern.substring(0, matcherEnd)
: pattern.substring(0, pattern.indexOf(unit, matcherEnd) + unit.length());
}
} catch (ItemNotFoundException e) {
logger.warn("Cannot retrieve item '{}' for widget {}", itemName, w.eClass().getInstanceTypeName());
Expand Down

0 comments on commit f711373

Please sign in to comment.