Skip to content

Commit e51f0a9

Browse files
authored
Update name checking (#1083)
* Update checkName.ts Allow characters in names to match what Home app ACTUALLY supports * Update checkName.ts
1 parent ee41309 commit e51f0a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/util/checkName.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { CharacteristicValue, Nullable } from "../../types";
99
export function checkName(displayName: string, name: string, value: Nullable<CharacteristicValue>): void {
1010

1111
// Ensure the string starts and ends with a Unicode letter or number and allow any combination of letters, numbers, spaces, and apostrophes in the middle.
12-
if (typeof value === "string" && !(new RegExp(/^[\p{L}\p{N}][\p{L}\p{N} ']*[\p{L}\p{N}]$/u)).test(value)) {
12+
if (typeof value === "string" && !(new RegExp(/^[\p{L}\p{N}][\p{L}\p{N}\u2019 '.,-]*[\p{L}\p{N}\u2019]$/u)).test(value)) {
1313
console.warn("HAP-NodeJS WARNING: The accessory '" + displayName + "' has an invalid '" + name + "' characteristic ('" + value + "'). Please use only " +
1414
"alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent " +
1515
"the accessory from being added in the Home App or cause unresponsiveness.");

0 commit comments

Comments
 (0)