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

Open Beginner friendly
#346 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
64/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
api, backend

Research direction

Start in src/storage/version/put.js and trace where the If-Match header is parsed before the create path is chosen; the missing-source branch is what needs the new 412 return. Read the surrounding conditional-request handling to confirm If-Match: * and If-None-Match: * keep their current behaviour, then add a test next to the existing storage version PUT tests covering a specific ETag against a missing source. Done means that request returns 412 with no write, and the create-only path is unchanged.

Written by the indexing model from the issue text.

Description

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.

Dominant language
JavaScript
Stars
6
Forks
18
Avg merge
5h 12m
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from adobe/da-admin

All issues in adobe/da-admin

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.