fix: Svg image can't load currently.
This commit is contained in:
parent
f6e43f466d
commit
f77d2a47d1
|
@ -9,12 +9,20 @@ public class FilesController : ControllerBase
|
||||||
[HttpGet("{*filename}")]
|
[HttpGet("{*filename}")]
|
||||||
public IActionResult Images(string filename)
|
public IActionResult Images(string filename)
|
||||||
{
|
{
|
||||||
|
// 这里疑似有点太愚蠢了
|
||||||
string contentType = "image/png";
|
string contentType = "image/png";
|
||||||
|
|
||||||
if (filename.EndsWith("jpg") || filename.EndsWith("jpeg"))
|
if (filename.EndsWith("jpg") || filename.EndsWith("jpeg"))
|
||||||
{
|
{
|
||||||
contentType = "image/jpeg";
|
contentType = "image/jpeg";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (filename.EndsWith("svg"))
|
||||||
|
{
|
||||||
|
contentType = "image/svg+xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FileInfo imageFile = new(filename);
|
FileInfo imageFile = new(filename);
|
||||||
|
|
||||||
if (!imageFile.Exists)
|
if (!imageFile.Exists)
|
||||||
|
|
|
@ -24,10 +24,16 @@
|
||||||
"AvatarImage": "https://zzachary.top/img/ztqy_hub928259802d192ff5718c06370f0f2c4_48203_300x0_resize_q75_box.jpg"
|
"AvatarImage": "https://zzachary.top/img/ztqy_hub928259802d192ff5718c06370f0f2c4_48203_300x0_resize_q75_box.jpg"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Name": "Chenxu",
|
"Name": "不会写程序的晨旭",
|
||||||
"Description": "一个普通大学生",
|
"Description": "一个普通大学生",
|
||||||
"Link": "https://chenxutalk.top",
|
"Link": "https://chenxutalk.top",
|
||||||
"AvatarImage": "https://www.chenxutalk.top/img/photo.png"
|
"AvatarImage": "https://www.chenxutalk.top/img/photo.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "万木长风",
|
||||||
|
"Description": "世界渲染中...",
|
||||||
|
"Link": "https://ryohai.fun",
|
||||||
|
"AvatarImage": "https://ryohai.fun/icon.jpg"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user