Skip to content

Domain-name in sub-domain not possible (at least a documentation issue) #584

@andreashaerter

Description

@andreashaerter

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 working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions