Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistent blank and invisible character processing of discovery properties #836

Merged
merged 1 commit into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private synchronized void readDiscoveryProperties() throws IOException {
continue;
}

newProperties.add(new RequiredProperty(discoveryElement[0].trim(), unescape(discoveryElement[1].trim())));
newProperties.add(new RequiredProperty(discoveryElement[0].trim(), unescape(discoveryElement[1]).trim()));
}

if (newProperties.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ xiaomi_lumisensormagnet,modelId=lumi.sensor_magnet
xiaomi_lumiremotemini,modelId=lumi.remote.b1acn01
innr-rc-110,vendor=innr,modelId=RC 110
osram-switch-4x-eu,vendor=OSRAM,modelId=Switch 4x EU-LIGHTIFY
legrand_dimmer_without_neutral,vendor=\u001f Legrand,modelId=\u001f Dimmer switch w/o neutral
legrand_dimmer_without_neutral,vendor=Legrand,modelId=Dimmer switch w/o neutral
tuya_ts0041,modelId=TS0041
tuya_ts0042,modelId=TS0042
tuya_ts0043,modelId=TS0043
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,11 @@ public void testMatcher()
properties = new HashMap<>();
properties.put(Thing.PROPERTY_VENDOR, "Vendor3");
assertEquals(null, matcher.matchThingType(properties));

// Match with invisible characters
properties = new HashMap<>();
properties.put(Thing.PROPERTY_VENDOR, "Vendor4");
properties.put(Thing.PROPERTY_MODEL_ID, "Model3");
assertEquals(new ThingTypeUID("zigbee:type5"), matcher.matchThingType(properties));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ type1,vendor=Vendor1,modelId=Model1
type2,vendor=Vendor2,modelId=Model2
type3,vendor=Vendor1,modelId=Model2
type4,vendor=Vendor1,modelId=Model2,firmwareVersion=Version4
type5,vendor=\u001F Vendor4,modelId= Model3\u001F