aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/ImageController.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2020-12-15 12:24:05 +0100
committerJoshua M. Boniface <joshua@boniface.me>2020-12-30 18:55:50 -0500
commitc86c652006084139a0330e09eb30735f2ece899e (patch)
tree7b6969cea9d0dbb9199bea385a48edcd38977e6f /Jellyfin.Api/Controllers/ImageController.cs
parentc08ce82a044ec1a04c07a1a208ac093ff3bbbf57 (diff)
Merge pull request #4794 from cvium/fix_image_upload
Convert from base64 when saving item images (cherry picked from commit e84622b4ab1b89518cf3f93756d3288ffb7239a1) Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
Diffstat (limited to 'Jellyfin.Api/Controllers/ImageController.cs')
-rw-r--r--Jellyfin.Api/Controllers/ImageController.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.cs
index e828a0801..c606d327c 100644
--- a/Jellyfin.Api/Controllers/ImageController.cs
+++ b/Jellyfin.Api/Controllers/ImageController.cs
@@ -325,9 +325,11 @@ namespace Jellyfin.Api.Controllers
return NotFound();
}
+ await using var memoryStream = await GetMemoryStream(Request.Body).ConfigureAwait(false);
+
// Handle image/png; charset=utf-8
var mimeType = Request.ContentType.Split(';').FirstOrDefault();
- await _providerManager.SaveImage(item, Request.Body, mimeType, imageType, null, CancellationToken.None).ConfigureAwait(false);
+ await _providerManager.SaveImage(item, memoryStream, mimeType, imageType, null, CancellationToken.None).ConfigureAwait(false);
await item.UpdateToRepositoryAsync(ItemUpdateType.ImageUpdate, CancellationToken.None).ConfigureAwait(false);
return NoContent();
@@ -358,9 +360,11 @@ namespace Jellyfin.Api.Controllers
return NotFound();
}
+ await using var memoryStream = await GetMemoryStream(Request.Body).ConfigureAwait(false);
+
// Handle image/png; charset=utf-8
var mimeType = Request.ContentType.Split(';').FirstOrDefault();
- await _providerManager.SaveImage(item, Request.Body, mimeType, imageType, null, CancellationToken.None).ConfigureAwait(false);
+ await _providerManager.SaveImage(item, memoryStream, mimeType, imageType, null, CancellationToken.None).ConfigureAwait(false);
await item.UpdateToRepositoryAsync(ItemUpdateType.ImageUpdate, CancellationToken.None).ConfigureAwait(false);
return NoContent();