10000 fix: ensure we check names using the full UTF-8 character set. by hjdhjd · Pull Request #1052 · homebridge/HAP-NodeJS · GitHub
[go: up one dir, main page]

Skip to content

fix: ensure we check names using the full UTF-8 character set. #1052

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

Merged
merged 3 commits into from
Jul 4, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Don't valid name length.
  • Loading branch information
hjdhjd committed Jul 4, 2024
commit 122eef01e0865d672e1e8e4242abc4b1c3d345bf
2 changes: 1 addition & 1 deletion src/lib/util/checkName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { CharacteristicValue, Nullable } from "../../types";
export function checkName(displayName: string, name: string, value: Nullable<CharacteristicValue>): void {

// 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.
if (typeof value === "string" && value.length && !(new RegExp(/^[\p{L}\p{N}][\p{L}\p{N} ']*[\p{L}\p{N}]$/u)).test(value)) {
if (typeof value === "string" && !(new RegExp(/^[\p{L}\p{N}][\p{L}\p{N} ']*[\p{L}\p{N}]$/u)).test(value)) {
console.warn("HAP-NodeJS WARNING: The accessory '" + displayName + "' is getting published with the characteristic '" +
name + "'" + " not following HomeKit naming rules ('" + value + "'). " +
"Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. " +
Expand Down
Loading
0