Skip to content

Commit 3311c87

Browse files
committed
controllers::version::yank: Return early if the crate is already in the requested yanked status
1 parent 35d7c23 commit 3311c87

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/controllers/version/yank.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ fn modify_yank(req: &mut dyn RequestExt, yanked: bool) -> EndpointResult {
4242
if user.rights(req.app(), &owners)? < Rights::Publish {
4343
return Err(cargo_err("must already be an owner to yank or unyank"));
4444
}
45+
46+
if version.yanked == yanked {
47+
// The crate is alread in the state requested, nothing to do
48+
return ok_true();
49+
}
50+
4551
let action = if yanked {
4652
VersionAction::Yank
4753
} else {

0 commit comments

Comments
 (0)