Skip to content

Commit 0877d5b

Browse files
authored
Add files via upload
1 parent 3cf7dc8 commit 0877d5b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

frontend/js/results.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ function stopResize() {
7575
// ==================== IPv6 地址检测 ====================
7676
function 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

8283
function 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};">

0 commit comments

Comments
 (0)