Skip to content

Fix crash when creating an existing patchinfo package#19374

Open
Sahitya0805 wants to merge 1 commit intoopenSUSE:masterfrom
Sahitya0805:fix/issue-18711-patchinfo-crash
Open

Fix crash when creating an existing patchinfo package#19374
Sahitya0805 wants to merge 1 commit intoopenSUSE:masterfrom
Sahitya0805:fix/issue-18711-patchinfo-crash

Conversation

@Sahitya0805
Copy link
Contributor

@Sahitya0805 Sahitya0805 commented Mar 2, 2026

Hey Friends,

this PR resolves a crash in the Patchinfo creation flow when a package with the name "patchinfo" already exists in the project. Instead of throwing an ActiveRecord::RecordInvalid exception, the controller now catches it and shows a user-friendly error message.

Fixes #18711

To verify this change:

  • Go to a project where you have permissions (e.g., your home project).
  • Create a package named patchinfo manually if it doesn't exist.
  • Click on "Create patchinfo" in the project actions.
  • You should be redirected back to the project page with a flash error: "Validation failed: Project ... already has a package with the name patchinfo".

Automated tests:

Run the regression test to ensure the fix works as expected:

bundle exec rspec spec/controllers/webui/patchinfo_controller_spec.rb:114

Detailed Changes:

  • Modified PatchinfoController#create to rescue ActiveRecord::RecordInvalid.
  • Added a regression test in patchinfo_controller_spec.rb to cover the validation failure scenario.

@github-actions github-actions bot added Frontend Things related to the OBS RoR app Backend Things regarding the OBS backend labels Mar 2, 2026
@Sahitya0805 Sahitya0805 force-pushed the fix/issue-18711-patchinfo-crash branch from 2949ffe to 29f898e Compare March 2, 2026 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Things regarding the OBS backend Frontend Things related to the OBS RoR app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[production][patchinfo#create] Validation failed: Project home:$USERNAME already has a package with the name patchinfo

1 participant