Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop global var for uploads indexation #14418

Merged

Conversation

btry
Copy link
Contributor

@btry btry commented Mar 30, 2023

This change is required to allow a user to add files to a file field which is rendered with pre-uploaded files.

This use case may happen in Formcreator when a validator validates answers containing a file question. This PR is required for pluginsGLPI/formcreator#3226

The goal is to not start the uploads index from zero, but counts the existing inputs related to a file upload field instead.

Q A
Bug fix? no
New feature? yes/no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #number

@btry btry requested review from cedric-anne and stonebuzz March 30, 2023 08:43
Copy link
Member

@cedric-anne cedric-anne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm it fixes an issue.

It is really easy to reproduce:

  • open ticket creation form,
  • write some contents and paste an image inside it,
  • change category,
  • add some contents and paste another image inside it,
  • submit the form.
    -> First image remains in base64 and no document is created for it.

DOM before applying this fix (0 index is used twice, so first image inputs are overriden):
image

DOM after applying this fix (there are correct indexes):
image

Tested on both Chrome and Firefox.

@cedric-anne cedric-anne added this to the 10.0.7 milestone Mar 30, 2023
@cedric-anne cedric-anne merged commit ff7983e into glpi-project:10.0/bugfixes Mar 30, 2023
@btry btry deleted the better_indexs_count_file_uploads branch March 30, 2023 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants