Improved open file endpoint

This commit is contained in:
2025-07-10 19:28:15 +08:00
parent 17330fc104
commit ff0789904d
2 changed files with 6 additions and 4 deletions

View File

@ -19,6 +19,10 @@ public class FileController(
[HttpGet("{id}")]
public async Task<ActionResult> OpenFile(string id, [FromQuery] bool original = false)
{
// Support the file extension for client side data recognize
if (id.Contains("."))
id = id.Split('.').First();
var file = await fs.GetFileAsync(id);
if (file is null) return NotFound();