Parser swallows the pair after an empty value; builder mis-quotes brace-wrapped values and a bare `(`
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- backend
调研方向
Start in connection-string-parser.ts and inspect the !started parsing path, build(), needsQuotes, and the schema boolean coercion. Add focused regression coverage for empty values, brace-wrapped and parenthesized values, and unknown booleans; done should preserve key pairs and establish the intended quoting dialect and boolean behavior.
由索引模型根据 Issue 内容生成。
描述
Found while reviewing how node-mssql consumes this package (1.1.0; the same code is on master).
1. An empty unquoted value absorbs the next Key=Value pair.
parse('TrustServerCertificate=;Encrypt=true;Server=h') gives { trustservercertificate: ';Encrypt=true', server: 'h' }. The Encrypt key is lost and the empty value becomes ;Encrypt=true. The quoted form TrustServerCertificate="";Encrypt=true;Server=h parses correctly, so this is specific to the unstarted/unquoted branch (connection-string-parser.ts: the !started path pushes the first non-whitespace character without checking isTerminator). Templates rendered with an unset variable hit this.
Expected: { trustservercertificate: '', encrypt: 'true', server: 'h' }.
2. build() treats a value that starts with { and ends with } as already quoted.
build({ Pwd: '{a}' }) gives Pwd={a}, and parse() of that gives a, so a literal value {a} cannot round-trip. Expected Pwd={{a}}}, or an explicit per-key way to pass a pre-quoted value such as Driver={ODBC Driver 18 for SQL Server}, which is presumably what the heuristic exists for.
3. needsQuotes misses a bare (.
The regex alternative \|\( matches the two-character sequence |(, not (: build({ Pwd: 'a(b' }) gives Pwd=a(b while build({ Pwd: 'a|(b' }) is quoted. Also, } inside a quoted value is emitted as }}, which is the SqlClient convention; the ODBC SQLDriverConnect grammar does not define an escape for } inside braces, so it may be worth documenting which dialect build() targets.
4. Unknown boolean values coerce to true.
The schema coerces anything outside false/no/0 to true, so TrustServerCertificate=off or a typo becomes true, and Encrypt=strict loses its meaning. ADO.NET's SqlConnectionStringBuilder and the ODBC driver reject unrecognised boolean values; consider throwing, or keeping the raw string for keys that accept more than two values.
Happy to send PRs for 1 to 3 if that helps.
- 主要语言
- TypeScript
- 星标
- 9
- 派生
- 6
- 平均合并
- 1 天 21 小时
- 30 天内合并 PR
- 9
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tediousjs/connection-string 的其他 Issue
-
难度 5/5 一周以上 新手友好度 25/100
tediousjs/connection-string#6 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 35/100
查看 tediousjs/connection-string 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 72/100
zts212653/clowder-ai#1678 ·
维护者通常 1 天内回复
-
good first issue
难度 2/5 1-3 小时 新手友好度 64/100
Progressive-Victory/the-website#680 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100