Return 412 for If-Match on a missing source instead of creating it

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

从 src/storage/version/put.js 开始,追踪 If-Match 请求头在选择创建路径之前是在哪里解析的;需要新增 412 返回的是源不存在的分支。阅读周围的条件请求处理代码,确认 If-Match: * 和 If-None-Match: * 保持当前行为,然后在现有存储版本 PUT 测试旁边添加一个测试,覆盖针对不存在源的特定 ETag 情况。完成标准是:该请求返回 412 且不写入任何内容,并且仅创建的路径保持不变。

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

描述

In src/storage/version/put.js, a PUT with a specific If-Match: <etag> on a missing source falls into the create path and creates it. A writer that expects to update a page re-creates it after someone deleted it.

Change

  • A specific If-Match: <etag> on a missing source → 412, no write.
  • If-Match: * on a missing source → 412 (already true today).

Compatibility: technically breaking, but only for requests that already break HTTP semantics: If-Match with an ETag must fail when the resource doesn't exist (RFC 9110 §13.1.1). Callers that mean "create or overwrite" send no condition, and "create only" sends If-None-Match: *; neither changes. A search of first-party repos (2026-11-22) found no affected client; da-collab sends If-Match: *, which already returns 412 here.

Before switching, log every If-Match: <etag> on a missing source in production for a few weeks. With no real hits, switch with a release note; otherwise the log shows which callers to contact first.

主要语言
JavaScript
星标
6
派生
18
平均合并
5 小时 12 分钟
30 天内合并 PR
5

环境准备

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

从这里开始

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

adobe/da-admin 的其他 Issue

查看 adobe/da-admin 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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