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

[v2] URI template strict expansions leave !'()* unencoded

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

维护者通常 1 天内回复

@takagibit18 已经在做这个了。

开始于 2026年10月2日。

  • #2922 来自 @takagibit18 —— 未关闭

评估

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

调研方向

从 packages/core-internal/src/shared/uriTemplate.ts 开始,重点关注 UriTemplate.expand() 和 encodeValue(),然后使用 Node.js 24 或更高版本运行 repro.mjs 示例。完成的标准是 simple 和 query 扩展会按所示对 !'()* 进行百分号编码,而 reserved 和 fragment 扩展会保留其允许的字符。

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

描述

v1 v2
What happened?

UriTemplate.expand() leaves !'()* unchanged in simple expansions. Query values have the same problem: search{?q} with q: 'hello!' produces search?q=hello!.

encodeURIComponent() leaves these characters unchanged, and encodeValue() returns that output directly for strict expansion operators.

What did you expect?

Expected output from the snippet below:

%21%27%28%29%2A
search?q=hello%21

RFC 6570 section 3.2.1 permits unreserved characters in strict variable expansions. The five characters above are reserved and need percent-encoding. Reserved and fragment expansions can keep them.

Code to reproduce

Save this as repro.mjs at the SDK repository root and run node repro.mjs with Node.js 24 or later. It imports the source module directly.

import { UriTemplate } from './packages/core-internal/src/shared/uriTemplate.ts';

const value = "!'()*";
console.log(new UriTemplate('{value}').expand({ value }));
console.log(new UriTemplate('search{?q}').expand({ q: 'hello!' }));

Current output:

!'()*
search?q=hello!
SDK version

main at e16d27729ea2fae144a6d957fd0372d9eb0e6c58 (v2 source checkout). Tested with Node.js 24.12.0.

Area

Other

主要语言
TypeScript
星标
13.5k
派生
2.3k
平均合并
1 天 22 小时
30 天内合并 PR
52

环境准备

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

从这里开始

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

modelcontextprotocol/typescript-sdk 的其他 Issue

查看 modelcontextprotocol/typescript-sdk 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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