mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-25 04:45:50 +00:00
Skip parsing lists if null, and trim trailing space
This commit is contained in:
parent
cf2b246bc7
commit
6732e5efcc
@ -117,6 +117,9 @@ class ModrinthBridge extends BridgeAbstract
|
|||||||
// Converts lists like `foo, bar, baz` to `["foo", "bar", "baz"]`
|
// Converts lists like `foo, bar, baz` to `["foo", "bar", "baz"]`
|
||||||
protected function parseInputList($input): ?string
|
protected function parseInputList($input): ?string
|
||||||
{
|
{
|
||||||
|
if (empty($input)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
$items = array_filter(array_map('trim', explode(',', $input)));
|
$items = array_filter(array_map('trim', explode(',', $input)));
|
||||||
return $items ? json_encode($items) : null; // return nothing if string is empty
|
return $items ? json_encode($items) : null; // return nothing if string is empty
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user