babalae/better-genshin-impact · error · InvalidDataException
图片大小超过 {MaxDownloadBytes / 1024 / 1024} MB 限制。
Error message
图片大小超过 {MaxDownloadBytes / 1024 / 1024} MB 限制。 What it means
Error "图片大小超过 {MaxDownloadBytes / 1024 / 1024} MB 限制。" thrown in babalae/better-genshin-impact.
Source
Thrown at BetterGenshinImpact/View/Controls/Markdown/MarkdownImageLoader.cs:92
return cachedResult;
}
byte[] bytes;
if (source.Scheme.Equals("data", StringComparison.OrdinalIgnoreCase))
{
bytes = DecodeDataUri(source.OriginalString);
}
else if (source.IsFile)
{
var fileInfo = new FileInfo(source.LocalPath);
if (!fileInfo.Exists)
{
throw new FileNotFoundException("Markdown 图片不存在。", source.LocalPath);
}
if (fileInfo.Length > MaxDownloadBytes)
{
throw new InvalidDataException($"图片大小超过 {MaxDownloadBytes / 1024 / 1024} MB 限制。");
}
bytes = await File.ReadAllBytesAsync(fileInfo.FullName, cancellationToken);
}
else if (source.Scheme.Equals("pack", StringComparison.OrdinalIgnoreCase))
{
var resourceInfo = Application.GetResourceStream(source)
?? throw new FileNotFoundException("找不到 Markdown pack 资源。", source.ToString());
await using var resourceStream = resourceInfo.Stream;
bytes = await ReadLimitedAsync(resourceStream, cancellationToken);
}
else if (source.Scheme is "http" or "https")
{
using var response = await HttpClient.GetAsync(source, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
response.EnsureSuccessStatusCode();
if (response.Content.Headers.ContentLength > MaxDownloadBytes)
{
throw new InvalidDataException($"图片大小超过 {MaxDownloadBytes / 1024 / 1024} MB 限制。");View on GitHub (pinned to a7cb36712d)
Solutions
- 压缩图片使其小于大小限制后再引用
- 引用更小的图片资源
- 使用图床上压缩后的图片链接
Example fix
压缩图片或将图片体积降到限制以内再引用。
When it happens
Trigger: 图片字节数(本地文件长度、HTTP Content-Length 或流式累计读取)超过 MaxDownloadBytes 上限时抛出 InvalidDataException。
Common situations: Markdown 中嵌入了超大图片(超过设定MB数)。
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/56d0bae127485500.
Report an issue: GitHub.