Skip to content

Commit

Permalink
fix: ensure loc is always a string
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Aug 30, 2024
1 parent 2b16423 commit de9ecc2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/runtime/nitro/sitemap/urlset/normalise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ export function preNormalizeEntry(_e: SitemapUrl | string): ResolvedSitemapUrl {
e.loc = e.url
delete e.url
}
if (typeof e.loc !== 'string') {
e.loc = ''
}
// we want a uniform loc so we can dedupe using it, remove slashes and only get the path
e.loc = removeTrailingSlash(e.loc || '')
e.loc = removeTrailingSlash(e.loc)
e._abs = hasProtocol(e.loc, { acceptRelative: false, strict: false })
try {
e._path = e._abs ? parseURL(e.loc) : parsePath(e.loc)
Expand Down

0 comments on commit de9ecc2

Please sign in to comment.