@@ -239,8 +239,6 @@ def get_message_from_multiformatMessageString(data, rule, content_type="text"):
239
239
240
240
See here for the specification: https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html#_Toc34317468
241
241
"""
242
- if content_type not in {"text" , "markdown" }:
243
- raise ValueError ("Unexpected message content; expected 'text' or 'markdown'." )
244
242
if content_type == "markdown" and "markdown" in data :
245
243
# handle markdown content
246
244
markdown = data .get ("markdown" )
@@ -263,8 +261,7 @@ def get_message_from_multiformatMessageString(data, rule, content_type="text"):
263
261
if substitution_str in text and i < len (arguments ):
264
262
text = text .replace (substitution_str , arguments [i ])
265
263
return text
266
- else :
267
- return ""
264
+ return ""
268
265
269
266
270
267
def cve_try (val ):
@@ -405,13 +402,13 @@ def get_description(result, rule, location):
405
402
if (fullDescription != message ) and (fullDescription != shortDescription ):
406
403
description += f"**{ _ ('Rule full description' )} :** { fullDescription } \n "
407
404
if "markdown" in result ["message" ]:
408
- markdown = get_message_from_multiformatMessageString (
409
- result ["message" ], rule , content_type = "markdown" ,
410
- )
411
- # Replace "Details" with "Link" in the markdown
412
- markdown = markdown .replace ("Details" , "Link" )
413
- description += f"**{ _ ('Additional Details' )} :**\n { markdown } \n "
414
- description += "_(Unprintable characters are replaced with '?'; please see Mayhem for full reproducer.)_"
405
+ markdown = get_message_from_multiformatMessageString (
406
+ result ["message" ], rule , content_type = "markdown" ,
407
+ )
408
+ # Replace "Details" with "Link" in the markdown
409
+ markdown = markdown .replace ("Details" , "Link" )
410
+ description += f"**{ _ ('Additional Details' )} :**\n { markdown } \n "
411
+ description += "_(Unprintable characters are replaced with '?'; please see Mayhem for full reproducer.)_"
415
412
if len (result .get ("codeFlows" , [])) > 0 :
416
413
description += get_codeFlowsDescription (result ["codeFlows" ])
417
414
0 commit comments