Skip to content

Fix edge case when updating snippet with no repo

What does this MR do?

In this MR we solve an edge case when updating a snippet with no repository.

When the user displays the edit page for a snippet without a repository, a file will be built using the snippet database info, and rendered to the user. Then the user will perform some operations on the file or other files, but the FE will assume that the file exist. Therefore, if we update the non existing file, the action sent from the FE will be :update. Nevertheless, since the file does not exist, the BE will raise an error when performing that action.

Therefore, we need to commit first the information in the database, and then apply all the actions.

This is a very strange case because all snippet has been migrated but in case some self-hosted instance have snippet in a bad state, we can prevent some errors and help recovering them.

Does this MR meet the acceptance criteria?

Conformity

Refs #239327 (closed)

Merge request reports