From b5d542a7254c0bb3a894c5df37d099de811a5999 Mon Sep 17 00:00:00 2001 From: v6ole Date: Thu, 21 May 2026 18:10:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(ssh):=20=E4=BF=AE=E5=A4=8D=20More=20?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E6=A0=87=E8=AE=B0=E6=B8=85=E9=99=A4=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=90=8C=E8=A1=8C=E8=AE=BE=E5=A4=87=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _clean_output 中 `---- More ----[^\n]*` 会将整行删除,当 OLT 输出的 More 分页标记与设备数据出现在同一行时,该设备会被错误丢弃。 改为仅移除标记文本本身,保留同行后续的设备数据。 Olt 172.16.0.18 的 display onu slot 1 输出 93 台设备,修复前仅 解析出 90 台(丢失 3 台),修复后正确解析全部 93 台。 Co-Authored-By: Claude Sonnet 4.6 --- backend/app/services/ssh_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/app/services/ssh_service.py b/backend/app/services/ssh_service.py index fb8d18a..49e0449 100644 --- a/backend/app/services/ssh_service.py +++ b/backend/app/services/ssh_service.py @@ -176,8 +176,8 @@ class SSHService: """清理终端控制字符和 More 分页标记,避免污染解析""" # 移除 ANSI 转义序列 output = re.sub(r'\x1b\[[0-9;]*[a-zA-Z]', '', output) - # 移除 ---- More ---- 行(含前后控制字符) - output = re.sub(r'---- More ----[^\n]*', '', output) + # 移除 ---- More ---- 标记(仅标记本身,保留同行后续设备数据) + output = re.sub(r'---- More ----', '', output) # 将独立的 \r(不跟 \n)替换为空,避免覆盖行内容 output = re.sub(r'\r(?!\n)', '', output) return output