Skip to content

Feat: Allow national Unicode characters in monitor name#4785

Open
IgorA100 wants to merge 7 commits intoZoneMinder:masterfrom
IgorA100:patch-401263
Open

Feat: Allow national Unicode characters in monitor name#4785
IgorA100 wants to merge 7 commits intoZoneMinder:masterfrom
IgorA100:patch-401263

Conversation

@IgorA100
Copy link
Copy Markdown
Contributor

@IgorA100 IgorA100 commented May 2, 2026

No description provided.

IgorA100 added 5 commits May 2, 2026 20:17
…input, taking into account national Unicode characters.

In PHP, I'll simplify the regular expression.
… simply deleting the old one.

- Condition adjustment. Changed from:
if (($saferName != $newMonitor['Name']) and !@symlink($mid, $link_path)) {
to:
if (($saferName != $newMonitor['Id']) and !@symlink($mid, $link_path)) {
This condition was changed in ZoneMinder@203418d
But there was probably an error in the condition, since comparing one variable to itself is pointless, unless we're looking for prohibited characters in the name.
@IgorA100 IgorA100 marked this pull request as ready for review May 2, 2026 22:00
@IgorA100
Copy link
Copy Markdown
Contributor Author

IgorA100 commented May 5, 2026

@connortechnology
Are you unhappy with something?

$saferName = basename($newMonitor['Name']);
$link_path = $Storage->Path().'/'.$saferName;
if (($saferName != $newMonitor['Name']) and !@symlink($mid, $link_path)) {
if (($saferName != $newMonitor['Id']) and !@symlink($mid, $link_path)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks wrong

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates monitor-name validation so the classic monitor editor and the server-side Monitor model accept Unicode letters, which aligns monitor naming better with internationalized deployments.

Changes:

  • Expanded the client-side monitor name regex in the classic monitor form to allow Unicode letter characters.
  • Expanded the server-side Monitor name sanitizer with the same Unicode-aware regex.
  • Adjusted monitor-name symlink handling in the save action so name-based links are created when monitor names change.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
web/skins/classic/views/js/monitor.js.php Updates browser-side monitor name validation regex.
web/includes/Monitor.php Updates server-side monitor name filtering to allow Unicode letters.
web/includes/actions/monitor.php Adjusts symlink creation logic for monitor name paths during save/update.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +59 to 60
if ( elements['newMonitor[Name]'].value.search( /[^\w\p{L}\-\.\(\):\/ ]/u) >= 0 )
errors[errors.length] = "<?php echo translate('BadNameChars') ?>";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for the BadNameChars is specifically for creating a symlink out of the name. We could strip out badchars when creating the symlink and leave them otherwise. Or we could get rid of that symlink.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants