fix: regex

This commit is contained in:
sanish-bruno
2025-11-17 13:41:52 +05:30
parent 6d8f428140
commit 95bc670d8c

View File

@@ -5,13 +5,17 @@ import { validateSchema, transformItemsInCollection, hydrateSeqInCollection, uui
// Content type patterns for matching MIME type variants
// These patterns handle structured types with many variants (e.g., application/ld+json, application/vnd.api+json)
// MIME types can contain: letters, numbers, hyphens, dots, and plus signs
const CONTENT_TYPE_PATTERNS = {
// Matches: application/json, application/ld+json, application/vnd.api+json, text/json, etc.
JSON: /^[\w\-]+\/([\w\-]+\+)?json$/,
// Matches: application/xml, text/xml, application/atom+xml, application/rss+xml, etc.
XML: /^[\w\-]+\/([\w\-]+\+)?xml$/,
// Matches: text/html, application/xhtml+xml
HTML: /^[\w\-]+\/([\w\-]+\+)?html$/
// Pattern: type/([base]+)?suffix where suffix is json
JSON: /^[\w\-.+]+\/([\w\-.+]+\+)?json$/,
// Matches: application/xml, text/xml, application/atom+xml, application/rss+xml, application/xhtml+xml, etc.
// Pattern: type/([base]+)?suffix where suffix is xml
XML: /^[\w\-.+]+\/([\w\-.+]+\+)?xml$/,
// Matches: text/html
// Pattern: type/([base]+)?suffix where suffix is html
HTML: /^[\w\-.+]+\/([\w\-.+]+\+)?html$/
};
const ensureUrl = (url) => {