diff options
Diffstat (limited to 'packages/astro-rss/src/util.ts')
-rw-r--r-- | packages/astro-rss/src/util.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/astro-rss/src/util.ts b/packages/astro-rss/src/util.ts index bc1589780..1e49b3d77 100644 --- a/packages/astro-rss/src/util.ts +++ b/packages/astro-rss/src/util.ts @@ -10,10 +10,10 @@ export function createCanonicalURL( let pathname = url.replace(/\/index.html$/, ''); // index.html is not canonical if (trailingSlash === false) { // remove the trailing slash - pathname = pathname.replace(/(\/+)?$/, ''); + pathname = pathname.replace(/\/*$/, ''); } else if (!getUrlExtension(url)) { // add trailing slash if there’s no extension or `trailingSlash` is true - pathname = pathname.replace(/(\/+)?$/, '/'); + pathname = pathname.replace(/\/*$/, '/'); } pathname = pathname.replace(/\/+/g, '/'); // remove duplicate slashes (URL() won’t) |