Skip to content

Commit 845e134

Browse files
fix americas test kitchen import "tool" prop parsing
1 parent 5b39868 commit 845e134

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

lib/Helper/Filter/JSON/FixToolsFilter.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,7 @@ public function apply(array &$json): bool {
5555
$tools[] = $t;
5656
}
5757
} else {
58-
$tools = array_map(function ($t) {
59-
$t = trim($t);
60-
$t = $this->textCleaner->cleanUp($t, false);
61-
62-
return $t;
63-
}, $json[self::TOOLS]);
58+
$tools = $this->processArrayRecursively($json[self::TOOLS]);
6459
$tools = array_filter($tools, fn ($t) => ($t));
6560
ksort($tools);
6661
$tools = array_values($tools);
@@ -71,4 +66,17 @@ public function apply(array &$json): bool {
7166

7267
return $changed;
7368
}
69+
70+
private function processArrayRecursively($array) {
71+
return array_map(function ($item) {
72+
if (is_array($item)) {
73+
return $this->processArrayRecursively($item);
74+
} else {
75+
$item = trim($item);
76+
$item = $this->textCleaner->cleanUp($item, false);
77+
return $item;
78+
}
79+
}, $array);
80+
}
81+
7482
}

src/js/helper.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ function isSameItemInstance(url1, url2) {
8181
*/
8282

8383
function escapeHTML(text) {
84+
if (typeof text !== 'string') {
85+
return text;
86+
}
8487
return text.replace(
8588
/["&'<>]/g,
8689
(a) =>

0 commit comments

Comments
 (0)