mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Log error messages when the manifest URL is not valid
This commit is contained in:
parent
15dd46c25a
commit
ed88430429
@ -3,8 +3,10 @@ using System.Collections.Concurrent;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -120,11 +122,15 @@ namespace Emby.Server.Implementations.Updates
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public async Task<IReadOnlyList<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken = default)
|
public async Task<IReadOnlyList<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
var manifestUrl = _appConfig.GetValue<string>(PluginManifestUrlKey);
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
using (var response = await _httpClient.SendAsync(
|
using (var response = await _httpClient.SendAsync(
|
||||||
new HttpRequestOptions
|
new HttpRequestOptions
|
||||||
{
|
{
|
||||||
Url = _appConfig.GetValue<string>(PluginManifestUrlKey),
|
Url = manifestUrl,
|
||||||
CancellationToken = cancellationToken,
|
CancellationToken = cancellationToken,
|
||||||
CacheMode = CacheMode.Unconditional,
|
CacheMode = CacheMode.Unconditional,
|
||||||
CacheLength = TimeSpan.FromMinutes(3)
|
CacheLength = TimeSpan.FromMinutes(3)
|
||||||
@ -132,8 +138,28 @@ namespace Emby.Server.Implementations.Updates
|
|||||||
HttpMethod.Get).ConfigureAwait(false))
|
HttpMethod.Get).ConfigureAwait(false))
|
||||||
using (Stream stream = response.Content)
|
using (Stream stream = response.Content)
|
||||||
{
|
{
|
||||||
return await _jsonSerializer.DeserializeFromStreamAsync<IReadOnlyList<PackageInfo>>(
|
try
|
||||||
stream).ConfigureAwait(false);
|
{
|
||||||
|
return await _jsonSerializer.DeserializeFromStreamAsync<IReadOnlyList<PackageInfo>>(stream).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (SerializationException ex)
|
||||||
|
{
|
||||||
|
const string LogTemplate =
|
||||||
|
"Failed to deserialize the plugin manifest retrieved from {PluginManifestUrl}. If you " +
|
||||||
|
"have specified a custom plugin repository manifest URL with --plugin-manifest-url or " +
|
||||||
|
PluginManifestUrlKey + ", please ensure that it is correct.";
|
||||||
|
_logger.LogError(ex, LogTemplate, manifestUrl);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (UriFormatException ex)
|
||||||
|
{
|
||||||
|
const string LogTemplate =
|
||||||
|
"The URL configured for the plugin repository manifest URL is not valid: {PluginManifestUrl}. " +
|
||||||
|
"Please check the URL configured by --plugin-manifest-url or " + PluginManifestUrlKey;
|
||||||
|
_logger.LogError(ex, LogTemplate, manifestUrl);
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user