0
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-24 20:38:36 +00:00

Skip parsing lists if null, and trim trailing space

This commit is contained in:
xnand-dot-xyz 2025-08-14 13:11:16 +01:00 committed by GitHub
parent cf2b246bc7
commit 6732e5efcc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -115,8 +115,11 @@ class ModrinthBridge extends BridgeAbstract
}
// 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)));
return $items ? json_encode($items) : null; // return nothing if string is empty
}