File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -103,17 +103,19 @@ def _validate_guid(value: str) -> str:
103103 """Validate GUID checksum format.
104104
105105 The format is 8-4-4-4-12 hexadecimal digits with hyphens (UUID format).
106+ The original case is preserved to avoid mismatches with downstream systems.
106107 Example: 6032CB7C-32DC-EC11-9A66-D85ED3091D71
107108 """
108- value = value .upper ()
109109 if len (value ) != 36 :
110110 raise ValueError (
111111 f"GUID checksum must be 36 characters long (including hyphens), got { len (value )} : { value } "
112112 )
113113
114114 # Validate UUID format: 8-4-4-4-12 with hyphens
115115 if not re .match (
116- r"^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$" , value
116+ r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" ,
117+ value ,
118+ re .IGNORECASE ,
117119 ):
118120 raise ValueError (f"GUID checksum must follow format 8-4-4-4-12 (UUID): { value } " )
119121
Original file line number Diff line number Diff line change @@ -112,17 +112,17 @@ def test_valid_guid_uppercase(self):
112112 )
113113
114114 def test_valid_guid_lowercase (self ):
115- """Test that valid lowercase GUID is normalized to uppercase ."""
115+ """Test that valid lowercase GUID is preserved as-is ."""
116116 assert (
117117 _validate_guid ("6032cb7c-32dc-ec11-9a66-d85ed3091d71" )
118- == "6032CB7C-32DC-EC11-9A66-D85ED3091D71 "
118+ == "6032cb7c-32dc-ec11-9a66-d85ed3091d71 "
119119 )
120120
121121 def test_valid_guid_mixed_case (self ):
122- """Test that valid mixed case GUID is normalized to uppercase ."""
122+ """Test that valid mixed case GUID is preserved as-is ."""
123123 assert (
124124 _validate_guid ("6032cb7C-32DC-ec11-9A66-d85eD3091d71" )
125- == "6032CB7C -32DC-EC11 -9A66-D85ED3091D71 "
125+ == "6032cb7C -32DC-ec11 -9A66-d85eD3091d71 "
126126 )
127127
128128 def test_guid_wrong_length_raises_error (self ):
You can’t perform that action at this time.
0 commit comments