Discussion turns everything after a link into part of the link

未关闭 适合新手
#2,404 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
frontend

调研方向

链接模式是 class-response.component.ts 中第 51 行附近的 urlMatcher;它的路径分组 (\/.*)? 一直延伸到行尾,且 scheme 是可选的,因此像 "roots.water" 这样的裸词也会匹配。先阅读该 regex 以及将其应用于帖子文本的代码,然后用 issue 中的示例复现。当链接在空白处停止、末尾标点被排除,并且示例句子只链接 "example.com/page" 时,即完成。

由索引模型根据 Issue 内容生成。

描述

When a Discussion post or reply contains a web address followed by more text on the same line, the rest of the line becomes part of the link.

How to reproduce

As a student, post "See example.com/page for the data, I think it is wrong." The whole of "example.com/page for the data, I think it is wrong." is one link, and clicking it opens a page that does not exist.

Cause

The path part of urlMatcher in class-response.component.ts (line 51) is (\/.*)?, which matches everything up to the end of the line. Two words joined by a period without a space, such as "roots.water", also become a link, since a scheme is optional and any 2 to 5 lowercase letters count as a top-level domain.

Possible fix

Limit the path to characters that cannot be whitespace, for example (\/[^\s<]*)?, and drop trailing punctuation from the match.

主要语言
TypeScript
星标
4
派生
8
平均合并
3 天 8 小时
30 天内合并 PR
12

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

WISE-Community/WISE-Client 的其他 Issue

查看 WISE-Community/WISE-Client 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。