Skip to content

Commit dbe3e75

Browse files
author
Binon
committed
Fixed the issue with fall back image downloading locally and cionsistent hadnling of '/' in urls'
1 parent 54703da commit dbe3e75

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

LearningHub.Nhs.WebUI/Views/Home/_CourseEnrolled.cshtml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{
1313
var apiBaseUrl = Configuration["MoodleAPIConfig:BaseUrl"];
1414
string path = $"course/view.php";
15-
string returnUrl = $@"{apiBaseUrl}/{path}?id={courseId}";
15+
string returnUrl = $@"{apiBaseUrl}{path}?id={courseId}";
1616

1717
return returnUrl;
1818
}
@@ -21,11 +21,9 @@
2121
<div class="nhsuk-card-banner-container">
2222
@if (!string.IsNullOrWhiteSpace(Model.CourseImage))
2323
{
24-
if (Model.CourseImage.EndsWith(".svg", StringComparison.OrdinalIgnoreCase))
24+
@if (Model.CourseImage.EndsWith(".svg", StringComparison.OrdinalIgnoreCase))
2525
{
26-
<object class="nhsuk-card__img nhsuk-card-banner" type="image/svg+xml" data="@Model.CourseImage">
27-
<img src="/images/default-course.jpg" alt="Fallback image" />
28-
</object>
26+
<img class="nhsuk-card__img nhsuk-card-banner" src="@Model.CourseImage" alt="Course image" onerror="this.onerror=null;this.src='/images/default-course.jpg';" />
2927
}
3028
else
3129
{

LearningHub.Nhs.WebUI/Views/Search/_ResourceSearchResult.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
var apiBaseUrl = Configuration["MoodleAPIConfig:BaseUrl"];
4040
string path = $"course/view.php";
41-
string returnUrl = $@"{apiBaseUrl}/{path}?id={courseId}";
41+
string returnUrl = $@"{apiBaseUrl}{path}?id={courseId}";
4242

4343
return returnUrl;
4444
}

0 commit comments

Comments
 (0)