File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,19 +74,33 @@ function extractSerialNumberFromBody (body) {
7474function extractRevocationReason ( body ) {
7575 if ( ! body ) return 'unspecified'
7676
77- const reasonMatch = body . match ( / r e a s o n [: : ] \s * ( \w + ) / i)
78- if ( ! reasonMatch ) return 'unspecified'
77+ // 格式1: ### Revocation Reason\n\nCompromised (GitHub issue 模板格式)
78+ const match1 = body . match ( / # # # \s * R e v o c a t i o n \s * R e a s o n \s * \n + ( \w + ) / i)
79+ if ( match1 ) {
80+ const reason = match1 [ 1 ] . toLowerCase ( )
81+ return mapRevocationReason ( reason )
82+ }
83+
84+ // 格式2: reason: xxx 或 reason:xxx
85+ const match2 = body . match ( / r e a s o n [: : ] \s * ( \w + ) / i)
86+ if ( match2 ) {
87+ const reason = match2 [ 1 ] . toLowerCase ( )
88+ return mapRevocationReason ( reason )
89+ }
7990
80- const reason = reasonMatch [ 1 ] . toLowerCase ( )
91+ return 'unspecified'
92+ }
8193
82- // 映射到标准 CRL 原因代码
94+ /**
95+ * 映射吊销原因到标准 CRL 原因代码
96+ */
97+ function mapRevocationReason ( reason ) {
8398 const reasonMap = {
8499 compromised : 'keyCompromise' ,
85100 lost : 'keyCompromise' ,
86101 superseded : 'superseded' ,
87102 other : 'unspecified'
88103 }
89-
90104 return reasonMap [ reason ] || 'unspecified'
91105}
92106
You can’t perform that action at this time.
0 commit comments