Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hosted zone filtering fix #609

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [7.3.2] - 2023-12-07

### Fixed
- Fixed hosted zone filtering, when the domain `api.mydomain.com` equals the host name `api.mydomain.com`.

## [7.3.1] - 2023-12-01

### Fixed
- Fixed hosted zone filtering.
- Fixed hosted zone filtering, when the domain `serverlessdevapi.mydomain.com` contains the host name `api.mydomain.com`.

## [7.3.0] - 2023-11-30

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-domain-manager",
"version": "7.3.1",
"version": "7.3.2",
"engines": {
"node": ">=14"
},
Expand Down
2 changes: 1 addition & 1 deletion src/aws/route53-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Route53Wrapper {
})
.filter((hostedZone) => {
const hostedZoneName = hostedZone.Name.replace(/\.$/, "");
return domainNameHost.endsWith(hostedZoneName);
return domain.givenDomainName === hostedZoneName || domainNameHost.endsWith(hostedZoneName);
})
.sort((zone1, zone2) => zone2.Name.length - zone1.Name.length)
.shift();
Expand Down
8 changes: 4 additions & 4 deletions test/unit-tests/aws/route53-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ describe("Route53 wrapper checks", () => {
Name: "api.test_domain",
}, {
CallerReference: "",
Config: {PrivateZone: true},
Id: "dummy_host_id",
Name: "test_domain",
Config: {PrivateZone: false},
Id: testId,
Name: "devapi.test_domain",
}, {
CallerReference: "",
Config: {PrivateZone: false},
Id: testId,
Id: "dummy_host_id",
Name: "test_domain",
},
]
Expand Down