Skip to content

Commit 37fa812

Browse files
committed
Enhance MIME type matching in CDI file detection to be case-insensitive and ensure exact profile validation
1 parent 40967b5 commit 37fa812

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

examples/cdi-exporter/transformer.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,13 @@ def find_cdi_file():
9393
continue
9494

9595
# Check for EXACT MIME type: application/ld+json with DDI-CDI profile
96-
# Must match: application/ld+json; profile="http://ddialliance.org/Specification/DDI-CDI/1.0/DDI-CDI.jsonld"
97-
content_type_str = str(content_type)
96+
# Must match: application/ld+json with ddialliance.org profile (case-insensitive)
97+
content_type_str = str(content_type).lower()
9898
is_cdi_mime = (
9999
'application/ld+json' in content_type_str and
100100
'profile=' in content_type_str and
101-
'ddialliance.org/Specification/DDI-CDI' in content_type_str
101+
'ddialliance.org' in content_type_str and
102+
'ddi-cdi' in content_type_str
102103
)
103104

104105
if is_cdi_mime:

0 commit comments

Comments
 (0)