Skip to content

Commit

Permalink
Hosted zone filtering fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rddimon committed Dec 7, 2023
1 parent dba13b4 commit bd48a2a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
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

0 comments on commit bd48a2a

Please sign in to comment.