-
-
Notifications
You must be signed in to change notification settings - Fork 200
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hi,
while working on #573, I recognized that there is a problematic code snippet at https://poshac.me/docs/v4/Plugins/Plugin-Development-Guide/#zone-matching:
$recShort = ($RecordName -ireplace [regex]::Escape($zoneName), [string]::Empty).TrimEnd('.')
This snippet will replace every occurrence of $zoneName
while it should only replace the last one:
$zoneName = "example.com"
$RecordName = "_acme-challenge.example.com.bar.baz.example.com"
$recShort = ($RecordName -ireplace [regex]::Escape($zoneName), [string]::Empty).TrimEnd('.')
Write-Host $recShort
Output: _acme-challenge..bar.baz
(instead of _acme-challenge.example.com.bar.baz
).
I did not check yet if there are plugins using this code. The impact should be low as most people won't use a subdomain like exmaple.com.example.com
, but better safe then sorry (plus: who knows which kind of side-effects a too greedy replace action might trigger beside a non-working edge case).
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working