fix: Svg image can't load currently.

This commit is contained in:
jackfiled 2024-09-08 22:34:20 +08:00
parent f6e43f466d
commit f77d2a47d1
2 changed files with 15 additions and 1 deletions

View File

@ -9,12 +9,20 @@ public class FilesController : ControllerBase
[HttpGet("{*filename}")]
public IActionResult Images(string filename)
{
// 这里疑似有点太愚蠢了
string contentType = "image/png";
if (filename.EndsWith("jpg") || filename.EndsWith("jpeg"))
{
contentType = "image/jpeg";
}
if (filename.EndsWith("svg"))
{
contentType = "image/svg+xml";
}
FileInfo imageFile = new(filename);
if (!imageFile.Exists)

View File

@ -24,10 +24,16 @@
"AvatarImage": "https://zzachary.top/img/ztqy_hub928259802d192ff5718c06370f0f2c4_48203_300x0_resize_q75_box.jpg"
},
{
"Name": "Chenxu",
"Name": "不会写程序的晨旭",
"Description": "一个普通大学生",
"Link": "https://chenxutalk.top",
"AvatarImage": "https://www.chenxutalk.top/img/photo.png"
},
{
"Name": "万木长风",
"Description": "世界渲染中...",
"Link": "https://ryohai.fun",
"AvatarImage": "https://ryohai.fun/icon.jpg"
}
]
}