Feat: Allow national Unicode characters in monitor name#4785
Open
IgorA100 wants to merge 7 commits intoZoneMinder:masterfrom
Open
Feat: Allow national Unicode characters in monitor name#4785IgorA100 wants to merge 7 commits intoZoneMinder:masterfrom
IgorA100 wants to merge 7 commits intoZoneMinder:masterfrom
Conversation
…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.
Contributor
Author
|
@connortechnology |
| $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)) { |
Contributor
There was a problem hiding this comment.
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
Monitorname 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') ?>"; |
Member
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.