fix: align backend APIs and upload flow

This commit is contained in:
2026-09-15 14:10:55 +08:00
parent 32177a7293
commit 53e6195938
149 changed files with 4791 additions and 435 deletions
@@ -1,6 +1,7 @@
using FileService.Application.UploadFile;
using FileService.Infrastructure;
using IM.ASPNETCore;
using IM.Commons;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -51,7 +52,8 @@ namespace FileService.WebApi.Controllers.File
[HttpGet("{id}")]
public async Task<IActionResult> Get(Guid id)
{
var res = await service.GetFileInfoAsync(id);
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
var res = await service.GetFileInfoAsync(id, Guid.Parse(userId));
return Ok(res);
}
@@ -65,11 +67,15 @@ namespace FileService.WebApi.Controllers.File
var res = await service.OpenDownloadAsync(id, Guid.Parse(userId));
if (res.Data == null)
{
if (res.Code == (int)ResultCode.PERMISSION_DENIED)
{
return StatusCode(StatusCodes.Status403Forbidden, res);
}
return NotFound(res);
}
Response.Headers["Cache-Control"] = "private,max-age=86400";
return File(res.Data.Content, res.Data.ContentType);
return File(res.Data.Content, res.Data.ContentType, enableRangeProcessing: true);
}
}
}