Skip to content

Commit f8d6944

Browse files
Fix: update VCML content sanitization to remove only ImageData tags
1 parent 52e4669 commit f8d6944

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

backend/app/services/vcelldb_service.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,28 @@
1313

1414
def sanitize_vcml_content(vcml_content: str) -> str:
1515
"""
16-
Sanitizes VCML content by removing all Image tags and their content.
16+
Sanitizes VCML content by removing only ImageData tags and their content.
1717
1818
Args:
1919
vcml_content (str): Raw VCML content as string.
2020
2121
Returns:
22-
str: Sanitized VCML content with all Image tags removed.
22+
str: Sanitized VCML content with ImageData tags removed.
2323
"""
24-
# Remove all Image tags and their content using regex
25-
# This pattern matches <Image ...> ... </Image> including nested content
24+
# Remove only ImageData tags and their content using regex
25+
# This pattern matches <ImageData ...> ... </ImageData> including nested content
2626
# The pattern handles multiline content and preserves the rest of the XML structure
2727
sanitized_content = re.sub(
28-
r'<Image[^>]*>.*?</Image>',
28+
r'<ImageData[^>]*>.*?</ImageData>',
2929
'',
3030
vcml_content,
3131
flags=re.DOTALL | re.MULTILINE
3232
)
3333

34-
# Clean up any extra whitespace that might be left after removing images
34+
# Clean up any extra whitespace that might be left after removing ImageData
3535
sanitized_content = re.sub(r'\n\s*\n', '\n', sanitized_content)
3636

37-
logger.info("VCML content sanitized: Image tags removed")
37+
logger.info("VCML content sanitized: ImageData tags removed")
3838
return sanitized_content
3939

4040

0 commit comments

Comments
 (0)