Skip to content

Commit 8963124

Browse files
author
Mathis Koblin
committed
Make sure to trim values before comparison #19
1 parent 9153397 commit 8963124

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

Classes/Metadata/MetadataUpdateObject.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,13 @@ private function clearMetadataRecord(array $metadata): array
7474
{
7575
// unset all fields that are not in $this->fieldsToCheck
7676
foreach ($metadata as $key => $value) {
77+
if (is_string($value)) {
78+
$value = trim($value);
79+
}
7780
if (!in_array($key, $this->fieldsToCheck) || empty($value)) {
7881
unset($metadata[$key]);
82+
} else {
83+
$metadata[$key] = $value;
7984
}
8085
}
8186
return $metadata;

Tests/Functional/Command/DataSet/sys_file_duplicates_with_metadata.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
,"507cf53279411321324cd2f424e0688e","sys_file_metadata","8","","","sys_file","8"
2121
"sys_file_metadata",,,
2222
,"uid","file","description"
23-
,1,1,"ABC"
23+
,1,1,"ABC "
2424
,2,2,"ABC"
2525
,3,3,"ABCD"
2626
,4,4,"ABC"

Tests/Functional/Command/DataSet/sys_file_duplicates_with_metadata_oldest_RESULT.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
,"507cf53279411321324cd2f424e0687e","sys_file_metadata","7","","","sys_file","7"
1515
"sys_file_metadata",,,
1616
,"uid","file","description","sys_language_uid"
17-
,1,1,"ABC",0
17+
,1,1,"ABC ",0
1818
,3,3,"ABCD",0
1919
,4,4,"ABC",0
2020
,5,5,"ABC",0

0 commit comments

Comments
 (0)