mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-02 10:08:39 +00:00
fix invalid mimetype when dealing with gameAssets
This commit is contained in:
parent
4437470bc5
commit
108ed71f64
1 changed files with 11 additions and 2 deletions
|
@ -39,8 +39,6 @@ public class ResourcesController : ControllerBase
|
||||||
return this.Ok(LbpSerializer.StringElement("resources", resources));
|
return this.Ok(LbpSerializer.StringElement("resources", resources));
|
||||||
}
|
}
|
||||||
|
|
||||||
[ResponseCache(Duration = 86400)]
|
|
||||||
[HttpGet("/gameAssets/{hash}")]
|
|
||||||
[HttpGet("r/{hash}")]
|
[HttpGet("r/{hash}")]
|
||||||
public IActionResult GetResource(string hash)
|
public IActionResult GetResource(string hash)
|
||||||
{
|
{
|
||||||
|
@ -51,6 +49,17 @@ public class ResourcesController : ControllerBase
|
||||||
return this.NotFound();
|
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
|
// TODO: check if this is a valid hash
|
||||||
[HttpPost("upload/{hash}")]
|
[HttpPost("upload/{hash}")]
|
||||||
public async Task<IActionResult> UploadResource(string hash)
|
public async Task<IActionResult> UploadResource(string hash)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue