Skip to content

Avoid updating snippet content when snippet_files content is not present

What does this MR do?

There are actions that will be included in the snippet_files param that don't always have the content field. Nevertheless, in https://gitlab.com/gitlab-org/gitlab/blob/master/app/services/snippets/update_service.rb#L41 we always use the content and override the existing value in params.

That is invalid because we will make the content nil and a validation error will be raised. We only need to update params[:content] when the content inside snippet_files is not empty.

We don't need to do the same with file_path because this param will be present in every possible action.

Refs #218516 (closed)

Does this MR meet the acceptance criteria?

Conformity

Edited by 🤖 GitLab Bot 🤖

Merge request reports