Skip to content

Commit

Permalink
fix: 🐛 fix handling of /index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
nicgirault committed Mar 17, 2020
1 parent 7e030e6 commit 409adf6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/cloudfront.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ describe("cloudfront", () => {
describe("getCacheInvalidations", () => {
it.each([
{ input: "index.html", expectedOutput: "/index.html" },
{ input: "/index.html", expectedOutput: "/index.html" },
{
input: "index.html, hello.html",
subFolder: undefined,
Expand Down
2 changes: 1 addition & 1 deletion src/cloudfront.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export const getCacheInvalidations = (
) =>
cacheInvalidations
.split(",")
.map(string => string.trim().replace(/$\//, ""))
.map(string => string.trim().replace(/^\//, ""))
.map(string => (subFolder ? `/${subFolder}/${string}` : `/${string}`))
.join(",");

Expand Down

0 comments on commit 409adf6

Please sign in to comment.