Skip to content

Commit 5d585ba

Browse files
committed
Update checkName.ts
1 parent 6dd97b4 commit 5d585ba

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/lib/util/checkName.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@
66

77
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
88
export function checkName(displayName: string, name: string, value: any): void {
9-
if (!value) {
10-
console.warn(`HAP-NodeJS WARNING: The accessory '${displayName}' is getting published with an empty '${name}'. This is not allowed.`);
11-
return;
12-
}
13-
149
const validHK = /^[a-zA-Z0-9\s'-.]+$/; // Ensure only letter, numbers, apostrophe, or dash
1510
const startWith = /^[a-zA-Z0-9]/; // Ensure only letters or numbers are at the beginning of string
1611
const endWith = /[a-zA-Z0-9]$/; // Ensure only letters or numbers are at the end of string
1712

18-
if (!validHK.test(value) || !startWith.test(value) || !endWith.test(value)) {
13+
if (typeof value !== "string" || !validHK.test(value) || !startWith.test(value) || !endWith.test(value)) {
1914
console.warn("HAP-NodeJS WARNING: The accessory '" + displayName + "' is getting published with the characteristic '" +
2015
name + "'" + " not following HomeKit naming rules ('" + value + "'). " +
2116
"Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. " +

0 commit comments

Comments
 (0)