barnybug / cli53

Command line tool for Amazon Route 53

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

shortenName overzealously removes suffixes

al-yisun opened this issue · comments

Issue type

  • Bug report

master

all

Steps to reproduce

call shortenName("a.b.fineexample.com", "example.com")

Expected behaviour

Shortens to a.b.fineexample.com

Actual behaviour

Shortens to a.b.fine

Have you checked if the documentation has the information you require?

n/a

Could you contribute a fix or help testing with this issue?

func shortenName(name, origin string) string {
	if name == origin {
		return "@"
	}
	return strings.TrimSuffix(name, "."+origin)
}

Thanks for reporting this.
Do you have an example zone file / command that demonstrates the issue which I could add to the tests?