mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
catch invalid URIs in icon and images fields
This commit is contained in:
parent
3790fb44c0
commit
4a4aa2d85c
1 changed files with 23 additions and 4 deletions
|
|
@ -1757,7 +1757,17 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
{
|
{
|
||||||
Log.Verbose($"Downloading icon for {manifest.InternalName} from {url}");
|
Log.Verbose($"Downloading icon for {manifest.InternalName} from {url}");
|
||||||
|
|
||||||
var data = await this.httpClient.GetAsync(url);
|
HttpResponseMessage data;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
data = await this.httpClient.GetAsync(url);
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
Log.Error($"Plugin icon for {manifest.InternalName} has an Invalid URI");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.StatusCode == HttpStatusCode.NotFound)
|
if (data.StatusCode == HttpStatusCode.NotFound)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1773,7 +1783,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Verbose($"Icon for {manifest.InternalName} is not available");
|
Log.Verbose($"Plugin icon for {manifest.InternalName} is not available");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DownloadPluginImagesAsync(LocalPlugin? plugin, PluginManifest manifest, bool isThirdParty)
|
private async Task DownloadPluginImagesAsync(LocalPlugin? plugin, PluginManifest manifest, bool isThirdParty)
|
||||||
|
|
@ -1793,7 +1803,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
|
|
||||||
if (image.Width > PluginImageWidth || image.Height > PluginImageHeight)
|
if (image.Width > PluginImageWidth || image.Height > PluginImageHeight)
|
||||||
{
|
{
|
||||||
Log.Error($"Image{i + 1} for {manifest.InternalName} at {loc} was larger than the maximum allowed resolution ({PluginImageWidth}x{PluginImageHeight}).");
|
Log.Error($"Plugin image{i + 1} for {manifest.InternalName} at {loc} was larger than the maximum allowed resolution ({PluginImageWidth}x{PluginImageHeight}).");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1852,7 +1862,16 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
|
|
||||||
Log.Verbose($"Downloading image{i + 1} for {manifest.InternalName} from {url}");
|
Log.Verbose($"Downloading image{i + 1} for {manifest.InternalName} from {url}");
|
||||||
|
|
||||||
var data = await this.httpClient.GetAsync(url);
|
HttpResponseMessage data;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
data = await this.httpClient.GetAsync(url);
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
Log.Error($"Plugin image{i + 1} for {manifest.InternalName} has an Invalid URI");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.StatusCode == HttpStatusCode.NotFound)
|
if (data.StatusCode == HttpStatusCode.NotFound)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue