From 3e8ba289c3e8ec9bffd136c44c572d6e0e3f8609 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Thu, 7 Nov 2024 19:51:34 +0100 Subject: [PATCH] [backend/drive] Fix incorrect mime type & file extension when converting original files (ISH-593) Closes #64 Co-authored-by: Tamara Schmitz --- Iceshrimp.Backend/Core/Services/DriveService.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Iceshrimp.Backend/Core/Services/DriveService.cs b/Iceshrimp.Backend/Core/Services/DriveService.cs index 12f958bf..4e7b8ae3 100644 --- a/Iceshrimp.Backend/Core/Services/DriveService.cs +++ b/Iceshrimp.Backend/Core/Services/DriveService.cs @@ -312,6 +312,12 @@ public class DriveService( throw new Exception("Uri must not be null at this stage"); } + if (original?.format.Format is { } fmt and not ImageFormat.Keep) + { + request.MimeType = fmt.MimeType; + request.Filename += $".{fmt.Extension}"; + } + file = new DriveFile { Id = IdHelpers.GenerateSnowflakeId(),