From 8b776405be254182bbc7de0bd7a4bbdc2d334fa5 Mon Sep 17 00:00:00 2001 From: MarcEricMartel <74071476+MarcEricMartel@users.noreply.github.com> Date: Wed, 2 Nov 2022 09:51:32 -0700 Subject: [PATCH] woups --- .../GrossesMitainesAPI/Controllers/ImageController.cs | 4 ++-- .../GrossesMitainesAPI/Services/DatabaseCacheService.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GrossesMitaines/GrossesMitainesAPI/Controllers/ImageController.cs b/GrossesMitaines/GrossesMitainesAPI/Controllers/ImageController.cs index 1ce66d0..bccb692 100644 --- a/GrossesMitaines/GrossesMitainesAPI/Controllers/ImageController.cs +++ b/GrossesMitaines/GrossesMitainesAPI/Controllers/ImageController.cs @@ -38,7 +38,7 @@ public class ImageController : ControllerBase { string path, filename, filetype; IQueryable query; - if (_cache is not null) + if (_cache is not null && _cache.isOk()) query = _cache.queryCache(); else query = _context.Products; @@ -54,7 +54,7 @@ public class ImageController : ControllerBase { Path.GetFileNameWithoutExtension(filename) + (thumbnail == true ? "_thumbnail" : "") + Path.GetExtension(filename)); - + if (!System.IO.File.Exists(path)) { _logger.LogError(8, "Unable to find image. Sending default image instead..."); path = Path.Combine(_hostEnvironment.ContentRootPath, "Images", "default.jpg"); diff --git a/GrossesMitaines/GrossesMitainesAPI/Services/DatabaseCacheService.cs b/GrossesMitaines/GrossesMitainesAPI/Services/DatabaseCacheService.cs index a5b6330..d53ab94 100644 --- a/GrossesMitaines/GrossesMitainesAPI/Services/DatabaseCacheService.cs +++ b/GrossesMitaines/GrossesMitainesAPI/Services/DatabaseCacheService.cs @@ -116,7 +116,7 @@ public class DatabaseCacheService { } return copy; } - public IQueryable queryCache() { + public IQueryable? queryCache() { if (!_ok) return null; try {