👔 File controller now return now when client request thumbnail but file has not

This commit is contained in:
2025-08-10 03:28:52 +08:00
parent 09d412053f
commit 360b58885e

View File

@@ -67,9 +67,16 @@ public class FileController(
var fileName = string.IsNullOrWhiteSpace(file.StorageId) ? file.Id : file.StorageId; var fileName = string.IsNullOrWhiteSpace(file.StorageId) ? file.Id : file.StorageId;
if (thumbnail && file.HasThumbnail) switch (thumbnail)
fileName += ".thumbnail"; {
else if (!original && file.HasCompression) case true when file.HasThumbnail:
fileName += ".thumbnail";
break;
case true when !file.HasThumbnail:
return NotFound();
}
if (!original && file.HasCompression)
fileName += ".compressed"; fileName += ".compressed";
if (dest.ImageProxy is not null && (file.MimeType?.StartsWith("image/") ?? false)) if (dest.ImageProxy is not null && (file.MimeType?.StartsWith("image/") ?? false))