Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions lib/Helper/Filter/JSON/FixToolsFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ public function apply(array &$json): bool {
$tools[] = $t;
}
} else {
$tools = array_map(function ($t) {
$t = trim($t);
$t = $this->textCleaner->cleanUp($t, false);

return $t;
}, $json[self::TOOLS]);
$tools = $this->processArrayRecursively($json[self::TOOLS]);
$tools = array_filter($tools, fn ($t) => ($t));
ksort($tools);
$tools = array_values($tools);
Expand All @@ -71,4 +66,17 @@ public function apply(array &$json): bool {

return $changed;
}

private function processArrayRecursively($array) {
return array_map(function ($item) {
if (is_array($item)) {
return $this->processArrayRecursively($item);
} else {
$item = trim($item);
$item = $this->textCleaner->cleanUp($item, false);
return $item;
}
}, $array);
}

}
3 changes: 3 additions & 0 deletions src/js/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ function isSameItemInstance(url1, url2) {
*/

function escapeHTML(text) {
if (typeof text !== 'string') {
return text;
}
return text.replace(
/["&'<>]/g,
(a) =>
Expand Down
Loading