Skip to content

Commit

Permalink
throw 500 if origin is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongitmail committed Sep 18, 2023
1 parent bba8bce commit 2be0273
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export async function response({
changefreq = false,
priority = false
}: SitemapConfig): Promise<Response> {
// 500. Value will often be from env.origin, which is easily misconfigured.
if (!origin) {
throw new Error('Sitemap: `origin` property is required in sitemap config.');
}

const paths = generatePaths(excludePatterns, paramValues);
const body = generateBody(origin, new Set([...paths, ...additionalPaths]), changefreq, priority);

Expand Down

0 comments on commit 2be0273

Please sign in to comment.