Skip to content

Commit

Permalink
fix(filefield): do not assume index of files
Browse files Browse the repository at this point in the history
whern adding, removing then adding again a file, indexes are somewhat consumed. Indes 0 will not exist in uploads list.
  • Loading branch information
btry committed Oct 27, 2022
1 parent 8792ed3 commit a02a9c7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions inc/field/filefield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ public function moveUploads() {
return;
}
$answer_value = [];
$index = 0;
foreach ($this->uploads["_$key"] as $document) {
foreach ($this->uploads["_$key"] as $index => $document) {
$document = Toolbox::stripslashes_deep($document);
if (is_file(GLPI_TMP_DIR . '/' . $document)) {
$prefix = $this->uploads['_prefix_formcreator_field_' . $this->question->getID()][$index];
Expand Down

0 comments on commit a02a9c7

Please sign in to comment.