From 7edac4f36bcba5b092522107ed2ce272cf815af8 Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 8 Feb 2022 23:56:35 +0000 Subject: [PATCH] Formatting --- VoidCat/Controllers/DownloadController.cs | 8 ++++---- VoidCat/Services/LocalDiskFileStorage.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/VoidCat/Controllers/DownloadController.cs b/VoidCat/Controllers/DownloadController.cs index ef50c74..f5edcca 100644 --- a/VoidCat/Controllers/DownloadController.cs +++ b/VoidCat/Controllers/DownloadController.cs @@ -24,7 +24,7 @@ public class DownloadController : Controller var gid = id.FromBase58Guid(); return SetupDownload(gid); } - + [ResponseCache(Location = ResponseCacheLocation.Any, Duration = 86400)] [HttpGet] [Route("{id}")] @@ -43,7 +43,7 @@ public class DownloadController : Controller Ranges = Enumerable.Empty() }; } - else if(egressReq.Ranges.Count() == 1) + else if (egressReq.Ranges.Count() == 1) { Response.StatusCode = (int)HttpStatusCode.PartialContent; } @@ -51,7 +51,7 @@ public class DownloadController : Controller { Response.Headers.AcceptRanges = "bytes"; } - + foreach (var range in egressReq.Ranges) { Response.Headers.Add("content-range", range.ToContentRange()); @@ -72,7 +72,7 @@ public class DownloadController : Controller Response.StatusCode = 404; return null; } - + Response.Headers.XFrameOptions = "SAMEORIGIN"; Response.Headers.ContentDisposition = $"inline; filename=\"{meta?.Metadata?.Name}\""; Response.ContentType = meta?.Metadata?.MimeType ?? "application/octet-stream"; diff --git a/VoidCat/Services/LocalDiskFileStorage.cs b/VoidCat/Services/LocalDiskFileStorage.cs index 7e701f7..542e093 100644 --- a/VoidCat/Services/LocalDiskFileStorage.cs +++ b/VoidCat/Services/LocalDiskFileStorage.cs @@ -112,7 +112,7 @@ public class LocalDiskFileIngressFactory : IFileStore using var buffer = MemoryPool.Shared.Rent(); foreach (var range in ranges) { - fileStream.Seek(range.Start ?? range.End ?? 0L, + fileStream.Seek(range.Start ?? range.End ?? 0L, range.Start.HasValue ? SeekOrigin.Begin : SeekOrigin.End); var readLength = 0;