Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Parser swallows the pair after an empty value; builder mis-quotes brace-wrapped values and a bare `(`

未关闭
#279 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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,通用步骤见我们的新手贡献指南。

从这里开始

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

tediousjs/connection-string 的其他 Issue

查看 tediousjs/connection-string 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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