From d4918ee8ff34ae973c42c2f667db8f2852ca003e Mon Sep 17 00:00:00 2001 From: Joseph Milazzo Date: Fri, 17 Dec 2021 16:29:41 -0600 Subject: [PATCH] More fixes (again) (#858) * Send stack trace to the UI on prod mode * Pdfs will now generate cover images. I missed something a few releases ago. --- API/Middleware/ExceptionMiddleware.cs | 14 +++++++------- API/Services/ReadingItemService.cs | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/API/Middleware/ExceptionMiddleware.cs b/API/Middleware/ExceptionMiddleware.cs index 8badfeb96..0712eaea1 100644 --- a/API/Middleware/ExceptionMiddleware.cs +++ b/API/Middleware/ExceptionMiddleware.cs @@ -14,7 +14,7 @@ namespace API.Middleware private readonly RequestDelegate _next; private readonly ILogger _logger; private readonly IHostEnvironment _env; - + public ExceptionMiddleware(RequestDelegate next, ILogger logger, IHostEnvironment env) { @@ -34,14 +34,14 @@ namespace API.Middleware _logger.LogError(ex, "There was an exception"); context.Response.ContentType = "application/json"; context.Response.StatusCode = (int) HttpStatusCode.InternalServerError; - - var response = _env.IsDevelopment() + + var response = _env.IsDevelopment() ? new ApiException(context.Response.StatusCode, ex.Message, ex.StackTrace) - : new ApiException(context.Response.StatusCode, "Internal Server Error"); - + : new ApiException(context.Response.StatusCode, "Internal Server Error", ex.StackTrace); + var options = new JsonSerializerOptions { - PropertyNamingPolicy = + PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; @@ -52,4 +52,4 @@ namespace API.Middleware } } } -} \ No newline at end of file +} diff --git a/API/Services/ReadingItemService.cs b/API/Services/ReadingItemService.cs index 07b5083af..12b02f163 100644 --- a/API/Services/ReadingItemService.cs +++ b/API/Services/ReadingItemService.cs @@ -86,6 +86,7 @@ public class ReadingItemService : IReadingItemService MangaFormat.Epub => _bookService.GetCoverImage(filePath, fileName), MangaFormat.Archive => _archiveService.GetCoverImage(filePath, fileName), MangaFormat.Image => _imageService.GetCoverImage(filePath, fileName), + MangaFormat.Pdf => _bookService.GetCoverImage(filePath, fileName), _ => string.Empty }; }