🐛 Add fallback logic when analyze image failed

This commit is contained in:
2025-07-25 15:09:09 +08:00
parent d7acf4fedf
commit f3ab4c4de1

View File

@@ -161,7 +161,7 @@ public class FileService(
/// </summary> /// </summary>
private async Task ExtractMetadataAsync(CloudFile file, string filePath, Stream stream) private async Task ExtractMetadataAsync(CloudFile file, string filePath, Stream stream)
{ {
switch (file.MimeType.Split('/')[0]) switch (file.MimeType?.Split('/')[0])
{ {
case "image": case "image":
try try
@@ -201,6 +201,7 @@ public class FileService(
} }
catch (Exception ex) catch (Exception ex)
{ {
file.FileMeta = new Dictionary<string, object?>();
logger.LogError(ex, "Failed to analyze image file {FileId}", file.Id); logger.LogError(ex, "Failed to analyze image file {FileId}", file.Id);
} }