Bug with files when rendering new snippet form
Summary
Sentry has an error in the new snippet form partial (views/shared/snippets/_form.html.haml:41
).
From a quick inspection it looks like the params are not what the form expects (a string instead of an array)
This appears to be caused by users manually manipulating the URL params - the controller actions do not appear to manipulate the files
param in such a way that it would return a string to the new
form and thus cause this error.
Kibana logs confirm this with instances of the string wrtqvetc
only being present in GET
requests.
What is the current bug behavior?
The error in sentry occurs
What is the expected correct behavior?
The error does not occur / the new snippet form is rendered
Possible fixes
https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/views/shared/snippets/_form.html.haml#L41 is where the error occurs, and could change to handle non-array file params, maybe something like:
From: - if params[:files]
To: - if params[:files]&.is_a?(Array)