Skip to content

Commit

Permalink
add changeset and tolerate trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
RichiCoder1 committed Mar 13, 2023
1 parent 452b232 commit c15b668
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/sweet-cherries-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/cloudflare': patch
---

fix automatic routes generation not respecting config.base
5 changes: 3 additions & 2 deletions packages/integrations/cloudflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ export default function createIntegration(args?: Options): AstroIntegration {

for (let page of pages) {
let pagePath = prependForwardSlash(page.pathname);
if (config.base !== '/') {
pagePath = `${config.base}${pagePath}`;
if (_config.base !== '/') {
const base = _config.base.endsWith('/') ? _config.base.substring(0, -1) : _config.base;
pagePath = `${base}${pagePath}`;
}
staticPathList.push(pagePath);
}
Expand Down

0 comments on commit c15b668

Please sign in to comment.