Skip to content

Commit

Permalink
Normalize channel name before suggesting it as item name
Browse files Browse the repository at this point in the history
Normalizing allows for channel names to contain subscript characters like in units; CO2.

Fixes openhab/openhab-addons#13909

Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
  • Loading branch information
Hilbrand committed Dec 13, 2022
1 parent 5052597 commit 4616a1f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export default {
this.loadProfileTypes(this.channel)
let newItemName = diacritic.clean(this.thing.label).replace(/[^0-9a-z]/gi, '')
newItemName += '_'
newItemName += (this.channel.label) ? diacritic.clean(this.channel.label).replace(/[^0-9a-z]/gi, '') : diacritic.clean(this.channelType.label).replace(/[^0-9a-z]/gi, '')
newItemName += diacritic.clean((this.channel.label || this.channelType.label).normalize`NFKD`).replace(/[^0-9a-z]/gi, '')
const defaultTags = (this.channel.defaultTags.length > 0) ? this.channel.defaultTags : this.channelType.tags
this.$set(this, 'newItem', {
name: newItemName,
Expand Down

0 comments on commit 4616a1f

Please sign in to comment.