Revisión | 25637e053d909e3e845894c02ded3bba91b5d2a4 (tree) |
---|---|
Tiempo | 2019-01-15 01:08:34 |
Autor | umorigu <umorigu@gmai...> |
Commiter | umorigu |
BugTrack/2420 AutoTicketLink - Improve regex and JSON encode
@@ -247,7 +247,7 @@ EOS; | ||
247 | 247 | 'base_uri_pathname' => get_base_uri(PKWK_URI_ROOT), |
248 | 248 | 'base_uri_absolute' => get_base_uri(PKWK_URI_ABSOLUTE) |
249 | 249 | ); |
250 | - $h_props = htmlsc(json_encode($props, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); | |
250 | + $h_props = htmlsc_json($props); | |
251 | 251 | $site_props = <<<EOS |
252 | 252 | <input type="hidden" class="site-props" value="$h_props" /> |
253 | 253 | EOS; |
@@ -273,8 +273,7 @@ EOS; | ||
273 | 273 | } |
274 | 274 | array_push($filtered_ticket_link_sites, $s); |
275 | 275 | } |
276 | - $h_ticket_link_sites = htmlsc(json_encode($filtered_ticket_link_sites, | |
277 | - JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); | |
276 | + $h_ticket_link_sites = htmlsc_json($filtered_ticket_link_sites); | |
278 | 277 | $ticketlink_data = <<<EOS |
279 | 278 | <input type="hidden" class="ticketlink-def" value="$h_ticket_link_sites" /> |
280 | 279 | EOS; |
@@ -124,10 +124,10 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function( | ||
124 | 124 | var reText = ''; |
125 | 125 | switch (site.type) { |
126 | 126 | case 'jira': |
127 | - reText = '(' + regexEscape(site.key) + '):([A-Z][A-Z0-9_]+-\\d+)'; | |
127 | + reText = '(' + regexEscape(site.key) + '):([A-Z][A-Z0-9]{1,20}-\\d{1,10})'; | |
128 | 128 | break; |
129 | 129 | case 'redmine': |
130 | - reText = '(' + regexEscape(site.key) + '):(\\d+)'; | |
130 | + reText = '(' + regexEscape(site.key) + '):(\\d{1,10})'; | |
131 | 131 | break; |
132 | 132 | case 'git': |
133 | 133 | reText = '(' + regexEscape(site.key) + '):([0-9a-f]{7,40})'; |