✨ Improved open file endpoint
This commit is contained in:
@ -1,5 +1,3 @@
|
||||
using Azure.Core;
|
||||
|
||||
namespace DysonNetwork.Sphere.Connection;
|
||||
|
||||
public class ClientTypeMiddleware(RequestDelegate next)
|
||||
@ -16,8 +14,8 @@ public class ClientTypeMiddleware(RequestDelegate next)
|
||||
}
|
||||
else
|
||||
{
|
||||
var userAgent = headers["User-Agent"].ToString();
|
||||
var accept = headers["Accept"].ToString();
|
||||
var userAgent = headers.UserAgent.ToString();
|
||||
var accept = headers.Accept.ToString();
|
||||
|
||||
// Priority 2: Check known app User-Agent (backward compatibility)
|
||||
if (!string.IsNullOrEmpty(userAgent) && userAgent.Contains("Solian"))
|
||||
|
@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user