From d280e932f914faf6ad2e51562145a217ad020fa8 Mon Sep 17 00:00:00 2001 From: Jean Fernandez <55406257+jean-the-coder@users.noreply.github.com> Date: Fri, 26 Apr 2024 10:48:00 -0400 Subject: [PATCH] Fix broken image path (#463) * Fix broken image path * switch to use .endsWith instead of == --- frontend/src/app/directives/image-fallback.directive.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/directives/image-fallback.directive.ts b/frontend/src/app/directives/image-fallback.directive.ts index f1c32f4c..788edf06 100644 --- a/frontend/src/app/directives/image-fallback.directive.ts +++ b/frontend/src/app/directives/image-fallback.directive.ts @@ -1,6 +1,6 @@ import {Directive, ElementRef, HostListener, Input} from '@angular/core'; -const DEFAULT_IMAGE_FALLBACK_PATH: string = '/assets/images/no-image.svg'; +const DEFAULT_IMAGE_FALLBACK_PATH: string = 'assets/images/no-image.svg'; @Directive({ selector: 'img[imageFallback]' @@ -14,7 +14,7 @@ export class ImageFallbackDirective { loadFallbackOnError() { // Check to see if we have already tried to load the fallback image. // Avoids endless loop if for some reason fallback image is missing. Just accept the broken image. - if (this.path(this.elementRef.nativeElement.src) == this.path(this.fallbackSrc())) { + if (this.path(this.elementRef.nativeElement.src).endsWith(this.path(this.fallbackSrc()))) { return; }