Skip to content

Commit

Permalink
frontend: avoid a duplicated "exists" check
Browse files Browse the repository at this point in the history
The commit 609d369 only partly resolved
the TOCTOU effects (which we are not fixing here either).  The problem
being fixed now is that we duplicated the duplication check,
- once in the `validate_on_submit()`, then
- using the `add(check_for_duplicates=True)`.
The later check is wrong though, because it raises an exception that is
not handled properly (exist_ok=True ignored).

Complements: fdff0c8
Complements: 609d369
Fixes: fedora-copr#3471
  • Loading branch information
praiskup committed Oct 10, 2024
1 parent 916f82f commit 50d24d3
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ def _form_field_repos(form_field):
selected_chroots=form.selected_chroots,
description=form.description.data,
instructions=form.instructions.data,
check_for_duplicates=True,
unlisted_on_hp=form.unlisted_on_hp.data,
build_enable_net=form.enable_net.data,
group=group,
Expand Down Expand Up @@ -278,7 +277,7 @@ def _form_field_repos(form_field):
"(race condition)"
) from ierr
except (
DuplicateException,
DuplicateException, # TODO: can this happen? and exist_ok?
NonAdminCannotCreatePersistentProject,
NonAdminCannotDisableAutoPrunning,
) as err:
Expand Down

0 comments on commit 50d24d3

Please sign in to comment.