diff --git a/VoidCat/Controllers/Admin/AdminController.cs b/VoidCat/Controllers/Admin/AdminController.cs index 49e152f..23618b5 100644 --- a/VoidCat/Controllers/Admin/AdminController.cs +++ b/VoidCat/Controllers/Admin/AdminController.cs @@ -96,7 +96,7 @@ public class AdminController : Controller { var oldUser = await _userStore.Get(user.Id); if (oldUser == default) return BadRequest(); - + await _userStore.AdminUpdateUser(user); return Ok(); } diff --git a/VoidCat/Controllers/DownloadController.cs b/VoidCat/Controllers/DownloadController.cs index 79ccea6..4e464d3 100644 --- a/VoidCat/Controllers/DownloadController.cs +++ b/VoidCat/Controllers/DownloadController.cs @@ -45,7 +45,7 @@ public class DownloadController : Controller var voidFile = await SetupDownload(gid); if (voidFile == default) return; - var egressReq = new EgressRequest(gid, GetRanges(Request, (long) voidFile!.Metadata!.Size)); + var egressReq = new EgressRequest(gid, GetRanges(Request, (long)voidFile!.Metadata!.Size)); if (egressReq.Ranges.Count() > 1) { _logger.LogWarning("Multi-range request not supported!"); @@ -57,10 +57,10 @@ public class DownloadController : Controller } else if (egressReq.Ranges.Count() == 1) { - Response.StatusCode = (int) HttpStatusCode.PartialContent; + Response.StatusCode = (int)HttpStatusCode.PartialContent; if (egressReq.Ranges.Sum(a => a.Size) == 0) { - Response.StatusCode = (int) HttpStatusCode.RequestedRangeNotSatisfiable; + Response.StatusCode = (int)HttpStatusCode.RequestedRangeNotSatisfiable; return; } } @@ -83,7 +83,7 @@ public class DownloadController : Controller Response.ContentLength = 0; return; } - + var cts = HttpContext.RequestAborted; await Response.StartAsync(cts); await _storage.Egress(egressReq, Response.Body, cts); @@ -105,7 +105,7 @@ public class DownloadController : Controller var orderId = Request.Headers.GetHeader("V-OrderId") ?? Request.Query["orderId"]; if (!await IsOrderPaid(orderId)) { - Response.StatusCode = (int) HttpStatusCode.PaymentRequired; + Response.StatusCode = (int)HttpStatusCode.PaymentRequired; return default; } } @@ -146,4 +146,4 @@ public class DownloadController : Controller } } } -} \ No newline at end of file +} diff --git a/VoidCat/Services/Captcha/NoOpVerifier.cs b/VoidCat/Services/Captcha/NoOpVerifier.cs index c08fff3..c3a24d4 100644 --- a/VoidCat/Services/Captcha/NoOpVerifier.cs +++ b/VoidCat/Services/Captcha/NoOpVerifier.cs @@ -12,4 +12,4 @@ public class NoOpVerifier : ICaptchaVerifier { return ValueTask.FromResult(true); } -} \ No newline at end of file +} diff --git a/VoidCat/Services/Files/S3FileStore.cs b/VoidCat/Services/Files/S3FileStore.cs index 5a1e849..cab33ab 100644 --- a/VoidCat/Services/Files/S3FileStore.cs +++ b/VoidCat/Services/Files/S3FileStore.cs @@ -28,7 +28,7 @@ public class S3FileStore : StreamFileStore, IFileStore public async ValueTask Ingress(IngressPayload payload, CancellationToken cts) { if (payload.IsAppend) throw new InvalidOperationException("Cannot append to S3 store"); - + var req = new PutObjectRequest { BucketName = _config.BucketName, @@ -41,12 +41,12 @@ public class S3FileStore : StreamFileStore, IFileStore ChecksumSHA256 = payload.Hash != default ? Convert.ToBase64String(payload.Hash!.FromHex()) : null, StreamTransferProgress = (s, e) => { - _statsCollector.TrackIngress(payload.Id, (ulong) e.IncrementTransferred) + _statsCollector.TrackIngress(payload.Id, (ulong)e.IncrementTransferred) .GetAwaiter().GetResult(); }, Headers = { - ContentLength = (long) payload.Meta.Size + ContentLength = (long)payload.Meta.Size } }; @@ -145,6 +145,7 @@ public class S3FileStore : StreamFileStore, IFileStore BucketName = _config.BucketName, Key = request.Id.ToString() }; + if (request.Ranges.Any()) { var r = request.Ranges.First(); @@ -154,4 +155,4 @@ public class S3FileStore : StreamFileStore, IFileStore var obj = await _client.GetObjectAsync(req, cts); return obj.ResponseStream; } -} \ No newline at end of file +} diff --git a/VoidCat/Services/Migrations/FixSize.cs b/VoidCat/Services/Migrations/FixSize.cs index 9f4e432..95c6ee5 100644 --- a/VoidCat/Services/Migrations/FixSize.cs +++ b/VoidCat/Services/Migrations/FixSize.cs @@ -49,4 +49,4 @@ public class FixSize : IMigration return IMigration.MigrationResult.Completed; } -} \ No newline at end of file +} diff --git a/VoidCat/Services/Users/UsersStartup.cs b/VoidCat/Services/Users/UsersStartup.cs index e1de418..a4da97d 100644 --- a/VoidCat/Services/Users/UsersStartup.cs +++ b/VoidCat/Services/Users/UsersStartup.cs @@ -22,4 +22,4 @@ public static class UsersStartup services.AddTransient(); } } -} \ No newline at end of file +} diff --git a/VoidCat/spa/src/Api.js b/VoidCat/spa/src/Api.js index a8479be..1b89953 100644 --- a/VoidCat/spa/src/Api.js +++ b/VoidCat/spa/src/Api.js @@ -22,7 +22,7 @@ export function useApi() { body: body ? JSON.stringify(body) : undefined }); } - + return { AdminApi: { fileList: (pageReq) => getJson("POST", "/admin/file", pageReq, auth),