fix invalid mimetype when dealing with gameAssets

This commit is contained in:
jvyden 2022-01-19 13:06:03 -05:00
commit 108ed71f64
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -39,8 +39,6 @@ public class ResourcesController : ControllerBase
return this.Ok(LbpSerializer.StringElement("resources", resources));
}
[ResponseCache(Duration = 86400)]
[HttpGet("/gameAssets/{hash}")]
[HttpGet("r/{hash}")]
public IActionResult GetResource(string hash)
{
@ -51,6 +49,17 @@ public class ResourcesController : ControllerBase
return this.NotFound();
}
[ResponseCache(Duration = 86400)]
[HttpGet("/gameAssets/{hash}")]
public IActionResult GetWebResource(string hash)
{
string path = FileHelper.GetResourcePath(hash);
if (FileHelper.ResourceExists(hash) && LbpFile.FromHash(hash)?.FileType == LbpFileType.Jpeg) return this.File(IOFile.OpenRead(path), "image/jpeg");
return this.NotFound();
}
// TODO: check if this is a valid hash
[HttpPost("upload/{hash}")]
public async Task<IActionResult> UploadResource(string hash)