@@ -239,8 +239,6 @@ def get_message_from_multiformatMessageString(data, rule, content_type="text"):
239239
240240 See here for the specification: https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html#_Toc34317468
241241 """
242- if content_type not in {"text" , "markdown" }:
243- raise ValueError ("Unexpected message content; expected 'text' or 'markdown'." )
244242 if content_type == "markdown" and "markdown" in data :
245243 # handle markdown content
246244 markdown = data .get ("markdown" )
@@ -263,8 +261,7 @@ def get_message_from_multiformatMessageString(data, rule, content_type="text"):
263261 if substitution_str in text and i < len (arguments ):
264262 text = text .replace (substitution_str , arguments [i ])
265263 return text
266- else :
267- return ""
264+ return ""
268265
269266
270267def cve_try (val ):
@@ -405,13 +402,13 @@ def get_description(result, rule, location):
405402 if (fullDescription != message ) and (fullDescription != shortDescription ):
406403 description += f"**{ _ ('Rule full description' )} :** { fullDescription } \n "
407404 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.)_"
415412 if len (result .get ("codeFlows" , [])) > 0 :
416413 description += get_codeFlowsDescription (result ["codeFlows" ])
417414
0 commit comments