File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,11 @@ def parse_openpgp_fields(decoded_data):
8787 offset += 2
8888 userid_length = decoded_data [offset ]
8989 offset += 1
90- attributes ['userId' ] = decoded_data [offset :offset + userid_length ].decode ('utf-8' )
90+ userId = decoded_data [offset :offset + userid_length ]
91+ try : # ugly temporary fix for encodings in userId
92+ attributes ['userId' ] = userId .decode ('utf-8' )
93+ except : # some exceptional cases appear to be triggering exceptions
94+ attributes ['userId' ] = userId
9195
9296
9397 else :
@@ -122,7 +126,13 @@ def ugly_inhouse_openpgp_block(pgp_armored_input):
122126
123127 decoded_blob = base64 .b64decode (base64_str .encode ('ascii' , 'ignore' ))
124128
125- openpgp_findings = parse_openpgp_fields (decoded_blob )
129+ try :
130+ openpgp_findings = parse_openpgp_fields (decoded_blob )
131+ except Exception as ex :
132+ print (f"Exception triggered in parse_openpgp_fields" )
133+ print (f"Printing base64 blob contents for debugging purposes." )
134+ print (base64_str )
135+ raise ex
126136
127137 # Add any comment and version values from the armored ascii to our findings.
128138 version_match = re .search (r'Version: (.+)\r?\n?' , pgp_armored_input )
You can’t perform that action at this time.
0 commit comments