File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,8 +75,9 @@ function stopResize() {
7575// ==================== IPv6 地址检测 ====================
7676function isIPv6 ( value ) {
7777 if ( ! value || typeof value !== 'string' ) return false ;
78- // IPv6 地址包含冒号且长度较长
79- return value . includes ( ':' ) && value . length > 15 ;
78+ // IPv6 地址包含至少 2 个冒号(排除 URL 的 http://),且不含 URL 路径斜杠
79+ const colons = ( value . match ( / : / g) || [ ] ) . length ;
80+ return colons >= 2 && ! value . includes ( '/' ) && ! value . includes ( '.' ) ;
8081}
8182
8283function formatIPv6 ( value ) {
@@ -177,7 +178,7 @@ export function renderTable(fields) {
177178 if ( field === 'link' ) cellClasses . push ( 'link-cell' ) ;
178179 const cellClass = cellClasses . join ( ' ' ) ;
179180 const recoveredCell = field === 'link' ? recoverEllipsizedLink ( cell , row , fields ) : cell ;
180- const displayValue = isIpv6 ? formatIPv6 ( recoveredCell ) : recoveredCell ;
181+ const displayValue = ( field === 'ip' && isIpv6 ) ? formatIPv6 ( recoveredCell ) : recoveredCell ;
181182 const colWidth = getColumnWidth ( field , fields . length ) ;
182183 return `
183184 <td title="${ escapeHtml ( recoveredCell ) } " class="${ cellClass } " style="max-width: ${ colWidth } ;">
You can’t perform that action at this time.
0 commit comments