From 360b58885e395b783a6e42be485d2fc753b681a5 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 10 Aug 2025 03:28:52 +0800 Subject: [PATCH] :necktie: File controller now return now when client request thumbnail but file has not --- DysonNetwork.Drive/Storage/FileController.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/DysonNetwork.Drive/Storage/FileController.cs b/DysonNetwork.Drive/Storage/FileController.cs index 0f48c8a..53565ed 100644 --- a/DysonNetwork.Drive/Storage/FileController.cs +++ b/DysonNetwork.Drive/Storage/FileController.cs @@ -67,9 +67,16 @@ public class FileController( var fileName = string.IsNullOrWhiteSpace(file.StorageId) ? file.Id : file.StorageId; - if (thumbnail && file.HasThumbnail) - fileName += ".thumbnail"; - else if (!original && file.HasCompression) + switch (thumbnail) + { + case true when file.HasThumbnail: + fileName += ".thumbnail"; + break; + case true when !file.HasThumbnail: + return NotFound(); + } + + if (!original && file.HasCompression) fileName += ".compressed"; if (dest.ImageProxy is not null && (file.MimeType?.StartsWith("image/") ?? false))