Rework Profile Picture Storage
This commit is contained in:
parent
df48a1491f
commit
957c3843d1
@ -32,7 +32,7 @@ namespace qtc_api.Controllers
|
||||
public async Task<ActionResult<ServiceResponse<Room>>> DeleteRoom(string roomId)
|
||||
{
|
||||
var response = await _roomService.DeleteRoom(roomId);
|
||||
await _hubContext.Clients.All.SendAsync("cf", "rul");
|
||||
await _hubContext.Clients.All.SendAsync("cf", "rr");
|
||||
return Ok(response);
|
||||
}
|
||||
|
||||
|
@ -249,8 +249,8 @@
|
||||
if (!Directory.Exists(cdnPath)) Directory.CreateDirectory(cdnPath!);
|
||||
if (!Directory.Exists($"{cdnPath}/{userId}")) Directory.CreateDirectory($"{cdnPath}/{userId}");
|
||||
|
||||
var fileName = $"{userId}.{file.FileName.Split('.')[1]}";
|
||||
var filePath = Path.Combine(cdnPath!, userId, fileName);
|
||||
var fileName = $"{userId}.pfp";
|
||||
var filePath = Path.Combine(cdnPath ?? "./user-content", userId, fileName);
|
||||
|
||||
using (var stream = File.Create(filePath))
|
||||
{
|
||||
@ -303,7 +303,7 @@
|
||||
serviceResponse.Success = true;
|
||||
serviceResponse.Message = user.ProfilePicture;
|
||||
|
||||
serviceResponse.Data = new FileContentResult(File.ReadAllBytes(pic), $"image/{Path.GetExtension(pic)}");
|
||||
serviceResponse.Data = new FileContentResult(File.ReadAllBytes(pic), "image/jpeg");
|
||||
} else
|
||||
{
|
||||
serviceResponse.Success = false;
|
||||
|
@ -34,4 +34,8 @@
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="user-content\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Loading…
x
Reference in New Issue
Block a user