Skip to content

bug: 开启隐私/去广告插件时,UA 解析逻辑导致评论提交崩溃 #1116

Closed

Description

@tjsky

问题描述:在评论者使用了 AdGuard 或某些隐私增强扩展时,navigator.userAgentData.getHighEntropyValues 可能返回不完整的对象(缺少 platformVersion 字段),导致无法提交评论。

感觉应该是 bui/artalk/src/lib/ua.ts 的这部分函数

  const uaData = (navigator as any).userAgentData
  let uaGot: any = null
  try {
    uaGot = await uaData.getHighEntropyValues(['platformVersion'])
  } catch (err) {
    console.error(err)
    return uaRaw
  }
  const majorPlatformVersion = Number(uaGot.platformVersion.split('.')[0])

若隐私增强扩展抹除了信息,使得 n.platformVersion 为 undefined 时就会引发崩溃,直接阻断 JS 的执行线程,导致无法提交评论,建议加个非空判断之类的东西。

Activity

  1. qwqcode commented on Oct 11, 2026

    @qwqcode
    Member

    感谢反馈,已确认是读取缺失的 platformVersion 时抛出异常,导致评论提交中断。修复已提交至 #1195:当浏览器或隐私扩展未提供完整信息时,回退到原始 User-Agent;正常的 Windows/macOS 版本识别保持不变。已补充回归测试,验证缺失字段时仍能提交评论。目前等待审查合并,尚未发布,先保持此 issue 开放。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions