drop global var for uploads indexation#14418
Merged
cedric-anne merged 1 commit intoglpi-project:10.0/bugfixesfrom Mar 30, 2023
Merged
drop global var for uploads indexation#14418cedric-anne merged 1 commit intoglpi-project:10.0/bugfixesfrom
cedric-anne merged 1 commit intoglpi-project:10.0/bugfixesfrom
Conversation
cedric-anne
reviewed
Mar 30, 2023
cedric-anne
approved these changes
Mar 30, 2023
Member
cedric-anne
left a comment
There was a problem hiding this comment.
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):

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

Tested on both Chrome and Firefox.
trasher
approved these changes
Mar 30, 2023
cconard96
approved these changes
Mar 30, 2023
AdrienClairembault
approved these changes
Mar 30, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.