Skip to content

Commit

Permalink
fix: unexpected close tag issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiAlexandruParaschiv committed Aug 20, 2024
1 parent 7a52c1a commit 8ca17d7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/sitemap/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,18 @@ export async function checkRobotsForSitemap(protocol, domain, log) {
reasons: sitemapPaths.length ? [] : [ERROR_CODES.NO_SITEMAP_IN_ROBOTS],
};
}

/**
* Checks if the sitemap content is valid.
*
* @param {{ payload: string, type: string }} sitemapContent - The sitemap content to validate.
* @returns {boolean} - True if the sitemap content is valid, otherwise false.
*/
export function isSitemapContentValid(sitemapContent) {
const payload = sitemapContent.payload.trim();
return payload.startsWith('<?xml') && payload.endsWith('>')
&& VALID_MIME_TYPES.some((type) => sitemapContent.type.includes(type));
return sitemapContent.payload.trim().startsWith('<?xml')
|| VALID_MIME_TYPES.some((type) => sitemapContent.type.includes(type));
}

/**
* Checks the validity and existence of a sitemap by fetching its content.
*
Expand Down

0 comments on commit 8ca17d7

Please sign in to comment.