Workaround some backends sending invalid UTF8 content.
This commit is contained in:
@@ -160,7 +160,11 @@ class JellyfinServer implements ServerInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
$json = json_decode($response->getContent(), true, flags: JSON_THROW_ON_ERROR);
|
||||
$json = json_decode(
|
||||
json: $response->getContent(),
|
||||
associative: true,
|
||||
flags: JSON_THROW_ON_ERROR | JSON_INVALID_UTF8_IGNORE
|
||||
);
|
||||
|
||||
$this->uuid = ag($json, 'Id', null);
|
||||
|
||||
@@ -185,7 +189,11 @@ class JellyfinServer implements ServerInterface
|
||||
);
|
||||
}
|
||||
|
||||
$json = json_decode($response->getContent(), true, flags: JSON_THROW_ON_ERROR);
|
||||
$json = json_decode(
|
||||
json: $response->getContent(),
|
||||
associative: true,
|
||||
flags: JSON_THROW_ON_ERROR | JSON_INVALID_UTF8_IGNORE
|
||||
);
|
||||
|
||||
$list = [];
|
||||
|
||||
@@ -676,7 +684,7 @@ class JellyfinServer implements ServerInterface
|
||||
$json = json_decode(
|
||||
json: $response->getContent(),
|
||||
associative: true,
|
||||
flags: JSON_THROW_ON_ERROR
|
||||
flags: JSON_THROW_ON_ERROR | JSON_INVALID_UTF8_IGNORE
|
||||
);
|
||||
|
||||
$json = ag($json, 'Items', [])[0] ?? [];
|
||||
@@ -1617,7 +1625,11 @@ class JellyfinServer implements ServerInterface
|
||||
return [];
|
||||
}
|
||||
|
||||
$json = json_decode($response->getContent(), true, flags: JSON_THROW_ON_ERROR);
|
||||
$json = json_decode(
|
||||
json: $response->getContent(),
|
||||
associative: true,
|
||||
flags: JSON_THROW_ON_ERROR | JSON_INVALID_UTF8_IGNORE
|
||||
);
|
||||
|
||||
if (null === ($type = ag($json, 'Type'))) {
|
||||
return [];
|
||||
|
||||
@@ -168,7 +168,11 @@ class PlexServer implements ServerInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
$json = json_decode($response->getContent(false), true, flags: JSON_THROW_ON_ERROR);
|
||||
$json = json_decode(
|
||||
json: $response->getContent(false),
|
||||
associative: true,
|
||||
flags: JSON_THROW_ON_ERROR | JSON_INVALID_UTF8_IGNORE
|
||||
);
|
||||
|
||||
$this->uuid = ag($json, 'MediaContainer.machineIdentifier', null);
|
||||
|
||||
@@ -200,7 +204,11 @@ class PlexServer implements ServerInterface
|
||||
);
|
||||
}
|
||||
|
||||
$json = json_decode($response->getContent(), true, flags: JSON_THROW_ON_ERROR);
|
||||
$json = json_decode(
|
||||
json: $response->getContent(),
|
||||
associative: true,
|
||||
flags: JSON_THROW_ON_ERROR | JSON_INVALID_UTF8_IGNORE
|
||||
);
|
||||
|
||||
$list = [];
|
||||
|
||||
@@ -1810,7 +1818,12 @@ class PlexServer implements ServerInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
$json = json_decode($response->getContent(), true, flags: JSON_THROW_ON_ERROR);
|
||||
$json = json_decode(
|
||||
json: $response->getContent(),
|
||||
associative: true,
|
||||
flags: JSON_THROW_ON_ERROR | JSON_INVALID_UTF8_IGNORE
|
||||
);
|
||||
|
||||
$tempToken = ag($json, 'authToken', null);
|
||||
|
||||
$url = Container::getNew(UriInterface::class)->withPort(443)->withScheme('https')->withHost('plex.tv')
|
||||
@@ -1839,7 +1852,11 @@ class PlexServer implements ServerInterface
|
||||
],
|
||||
]);
|
||||
|
||||
$json = json_decode($response->getContent(), true, flags: JSON_THROW_ON_ERROR);
|
||||
$json = json_decode(
|
||||
json: $response->getContent(),
|
||||
associative: true,
|
||||
flags: JSON_THROW_ON_ERROR | JSON_INVALID_UTF8_IGNORE
|
||||
);
|
||||
|
||||
foreach ($json ?? [] as $server) {
|
||||
if (ag($server, 'clientIdentifier') !== $uuid) {
|
||||
|
||||
Reference in New Issue
Block a user