diff --git a/DeepDrftManager/Components/Pages/Tracks/TrackEdit.razor b/DeepDrftManager/Components/Pages/Tracks/TrackEdit.razor
index 7352b35..f5a95aa 100644
--- a/DeepDrftManager/Components/Pages/Tracks/TrackEdit.razor
+++ b/DeepDrftManager/Components/Pages/Tracks/TrackEdit.razor
@@ -79,6 +79,18 @@
aria-label="Clear cover art" />
}
+ else if (_selectedImageFile is not null)
+ {
+
+ New image selected (not yet saved).
+
+
+ }
else
{
No cover art set.
diff --git a/DeepDrftManager/Services/CmsTrackService.cs b/DeepDrftManager/Services/CmsTrackService.cs
index 12a314e..c6fb909 100644
--- a/DeepDrftManager/Services/CmsTrackService.cs
+++ b/DeepDrftManager/Services/CmsTrackService.cs
@@ -241,16 +241,26 @@ public class CmsTrackService : ICmsTrackService
}
}
+ private static readonly HashSet KnownImageMimeTypes = new(StringComparer.OrdinalIgnoreCase)
+ {
+ "image/jpeg", "image/png", "image/gif", "image/webp", "image/svg+xml", "image/bmp"
+ };
+
public async Task> UploadImageAsync(
Stream imageStream,
string fileName,
string contentType,
CancellationToken ct = default)
{
+ if (string.IsNullOrWhiteSpace(contentType) || !KnownImageMimeTypes.Contains(contentType))
+ {
+ _logger.LogWarning("UploadImageAsync rejected: unsupported or missing content type '{ContentType}'", contentType);
+ return ResultContainer.CreateFailResult($"Unsupported image type: {contentType}. Accepted: JPEG, PNG, GIF, WebP, SVG, BMP.");
+ }
+
using var multipart = new MultipartFormDataContent();
var imageContent = new StreamContent(imageStream);
- imageContent.Headers.ContentType = new MediaTypeHeaderValue(
- string.IsNullOrWhiteSpace(contentType) ? "application/octet-stream" : contentType);
+ imageContent.Headers.ContentType = new MediaTypeHeaderValue(contentType);
multipart.Add(imageContent, "image", fileName);
var client = _httpClientFactory.CreateClient(ContentCmsClientName);