Skip to content

crate_owner_invitation: Accept crate name or ID in PUT /api/v1/me/crate_owner_invitations/{crate_id} - #15012

Open
eth3lbert wants to merge 3 commits into
rust-lang:mainfrom
eth3lbert:invitation-accept-crate-name
Open

eth3lbert wants to merge 3 commits into
rust-lang:mainfrom
eth3lbert:invitation-accept-crate-name

Conversation

@eth3lbert

Copy link
Copy Markdown
Contributor

As per #14897 (comment).

Previously, PUT /api/v1/me/crate_owner_invitations/{crate_id} only accepted an opaque crate identifier. However, most endpoints only returned crate name as crate_id, making this public API somewhat unusable for others. This change allow the endpoint to accept either a crate name or ID as crate_id. This makes the public API easier to use while preserving backward compatibility with callers that pass ID.

Related: https://rust-lang.zulipchat.com/#narrow/channel/318791-t-crates-io/topic/Accept.20pending.20invitations.20API/with/629562558

…ate_owner_invitations/{crate_id}`

Previously, `PUT /api/v1/me/crate_owner_invitations/{crate_id}` only
accepted an opaque crate identifier. However, most endpoints only
returned crate name as `crate_id`, making this public API somewhat
unusable for others. This change allow the endpoint to accept either a
crate name or ID as `crate_id`. This makes the public API easier to use
while preserving backward compatibility with callers that pass ID.
@eth3lbert
eth3lbert force-pushed the invitation-accept-crate-name branch from f5a5d55 to 6b560b4 Compare October 19, 2026 16:55
…me/crate_owner_invitations/{crate_id}`

Reject requests when the `crate_id` in the path does not match the
`crate_id` in the request body.
@eth3lbert
eth3lbert force-pushed the invitation-accept-crate-name branch from 6b560b4 to 5d56add Compare October 19, 2026 17:04
…_owner_invitations/{crate_id}`

This reject requests with invalid names such as those containing null
bytes before the database lookup. This prevents PostgreSQL errors from
surfacing as 500 responses and returns a 404 Not Found instead.
@eth3lbert
eth3lbert force-pushed the invitation-accept-crate-name branch from 5d56add to 3e40b65 Compare October 19, 2026 17:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants