Cleanup: simplify the link regex in Email.extractLink
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 重构
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- java
- 领域
- testing-qa
调研方向
该 regex 位于 src/main/java/com/seleniumboot/email/Email.java 的第 70 行,在 Email.extractLink(...) 内部。先阅读现有的 extractLink 测试,然后重写该模式,使任意两个部分都不能匹配相同的字符,同时保留引号风格、属性顺序和大小写不敏感性。当现有测试通过、一个包含大量 <a 标签且无匹配的长正文的新测试能快速结束,并且 mvn test 通过时即完成。
由索引模型根据 Issue 内容生成。
描述
Part of the cleanup cycle from #251. SonarCloud rule java:S8786 flags the link-matching regex in Email.extractLink(...) for possible super-linear backtracking. Email bodies come from outside, so this one is worth fixing.
Where: src/main/java/com/seleniumboot/email/Email.java, line 70:
"<a[^>]+href=[\"']([^\"']+)[\"'][^>]*>(.*?)</a>"
The [^>]+ before href can overlap with the attribute that follows it.
Fix: rewrite it so no two parts can match the same characters. For example, match <a\b, then attributes that don't start with href, then the href. Or use a possessive / atomic group. Keep the behaviour: double or single quotes, other attributes before or after href, nested tags in the link text, case-insensitive.
Done when: the existing extractLink tests still pass, a new test covers a long body with many <a tags and no match (it must finish quickly), SonarCloud no longer flags the line, and mvn test passes.
- 主要语言
- Java
- 星标
- 12
- 派生
- 6
- 平均合并
- 8 小时 58 分钟
- 30 天内合并 PR
- 63
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
seleniumboot/selenium-boot 的其他 Issue
-
good first issue
难度 2/5 1-3 小时 新手友好度 84/100
seleniumboot/selenium-boot#256 · 1 条评论 ·
维护者通常 1 天内回复
-
Split Locator.java into smaller files可能已有人在做 @Omartarek876 今天认领。 未关闭help wanted
seleniumboot/selenium-boot#277 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Cleanup: strip trailing slashes without a regex (GitHubActionsSummary, TestRail, Xray)可能已有人在做 @Omartarek876 今天认领。 未关闭good first issue
seleniumboot/selenium-boot#274 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Suggestions未关闭
难度 5/5 一周以上 新手友好度 25/100
seleniumboot/selenium-boot#251 · 3 条评论 ·
维护者通常 1 天内回复
查看 seleniumboot/selenium-boot 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
jenkins-infra/plugin-modernizer-tool#2070 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 84/100
orientechnologies/orientdb#11020 ·
维护者通常 1 天内回复
-
Event search answers 500 when calendars, attendees or organizers holds a null element可能重新可做 关联的 PR 已关闭且未合并。 未关闭ai-driven-qa bug Minor
难度 2/5 1-3 小时 新手友好度 70/100
linagora/twake-calendar-side-service#1615 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
eclipse-tradista/tradista#371 ·
维护者通常 1 天内回复