-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] the hostname of enpoint parser should parse dash symbol. #13
Conversation
概述遍历此更改修改了 变更
诗歌
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
Sources/EventStoreDB/ClientSettings/Parser/EndpointParser.swift (1)
90-90
: 建议增加额外的主机名验证考虑添加以下验证:
- 主机名总长度不应超过253个字符
- 每个标签(点号之间的部分)不应超过63个字符
- 主机名不应以破折号开头或结尾
建议修改正则表达式如下:
- One(.anyOf(".-_")) + TryCapture { + Regex { + ZeroOrMore(.word.subtracting(.anyOf("-"))) + One(.anyOf(".-_")) + ZeroOrMore(.word) + } + } transform: { + let hostname = String($0) + guard hostname.count <= 253, + !hostname.hasPrefix("-"), + !hostname.hasSuffix("-"), + hostname.split(separator: ".").allSatisfy({ $0.count <= 63 }) + else { return nil } + return hostname + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
Sources/EventStoreDB/ClientSettings/Parser/EndpointParser.swift
(1 hunks)Tests/EventStoreDBTests/ConnectionStringParserTests.swift
(1 hunks)
🔇 Additional comments (2)
Tests/EventStoreDBTests/ConnectionStringParserTests.swift (1)
48-56
: 测试用例设计合理!
新增的测试用例很好地验证了包含破折号的主机名解析功能,与现有的测试用例(localhost和IP地址)形成了完整的测试覆盖。
Sources/EventStoreDB/ClientSettings/Parser/EndpointParser.swift (1)
90-90
: 正则表达式修改恰当!
通过添加破折号和下划线的支持,使主机名解析更符合实际使用场景。
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
==========================================
+ Coverage 13.20% 13.24% +0.04%
==========================================
Files 110 110
Lines 19050 19059 +9
==========================================
+ Hits 2516 2525 +9
Misses 16534 16534 ☔ View full report in Codecov by Sentry. |
Summary by CodeRabbit