{"record":{"id":"18749e897f75af7b","repo":"babalae/better-genshin-impact","slug":"source-scheme","errorCode":null,"errorMessage":"不支持的图片协议：{source.Scheme}","messagePattern":"不支持的图片协议：(.+?)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/View/Controls/Markdown/MarkdownImageLoader.cs","lineNumber":118,"sourceCode":"                               ?? throw new FileNotFoundException(\"找不到 Markdown pack 资源。\", source.ToString());\n            await using var resourceStream = resourceInfo.Stream;\n            bytes = await ReadLimitedAsync(resourceStream, cancellationToken);\n        }\n        else if (source.Scheme is \"http\" or \"https\")\n        {\n            using var response = await HttpClient.GetAsync(source, HttpCompletionOption.ResponseHeadersRead, cancellationToken);\n            response.EnsureSuccessStatusCode();\n            if (response.Content.Headers.ContentLength > MaxDownloadBytes)\n            {\n                throw new InvalidDataException($\"图片大小超过 {MaxDownloadBytes / 1024 / 1024} MB 限制。\");\n            }\n\n            await using var responseStream = await response.Content.ReadAsStreamAsync(cancellationToken);\n            bytes = await ReadLimitedAsync(responseStream, cancellationToken);\n        }\n        else\n        {\n            throw new NotSupportedException($\"不支持的图片协议：{source.Scheme}\");\n        }\n\n        cancellationToken.ThrowIfCancellationRequested();\n        var result = DecodeImage(bytes);\n        _cache[cacheKey] = new WeakReference<MarkdownImageResult>(result);\n        return result;\n    }\n\n    private static HttpClient CreateHttpClient()\n    {\n        var client = new HttpClient(new HttpClientHandler\n        {\n            AllowAutoRedirect = true,\n            MaxAutomaticRedirections = 5,\n            UseCookies = false,\n            UseDefaultCredentials = false\n        })\n        {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/View/Controls/Markdown/MarkdownImageLoader.cs#L100-L136","documentation":"Error \"不支持的图片协议：{source.Scheme}\" thrown in babalae/better-genshin-impact.","triggerScenarios":"图片 Uri 的 Scheme 既不是 data、file、pack，也不是 http/https，落入 else 分支抛出 NotSupportedException。","commonSituations":"Markdown 中使用了 ftp、自定义协议等不支持的图片链接。","solutions":["仅使用支持的图片协议（http/https/data/pack）","将图片下载到本地后使用支持的引用方式","修改 Markdown 中的图片链接协议"],"exampleFix":"改用 http/https 链接、本地文件路径或 data URI。","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}