Skip to content

Commit c44be5e

Browse files
skeptrunedevfedhacks
authored andcommitted
bugfix: page html template when singleProductOptions is undefined
1 parent 1becbfc commit c44be5e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

server/src/handlers/page_handler.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,10 @@ pub async fn public_page(
309309
..config.PUBLIC_DATASET.extra_params.unwrap_or_default()
310310
}
311311
})
312-
.unwrap();
312+
.map_err(|e| {
313+
log::error!("Error rendering template: {:?}", e);
314+
ServiceError::InternalServerError("Error rendering template".to_string())
315+
})?;
313316

314317
Ok(HttpResponse::Ok().body(response_body))
315318
} else {

server/src/public/page.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,10 @@
280280
<main>
281281
<div class="basic">
282282
<div id="root" class="min-h-[36px]"></div>
283-
{% if params.singleProductOptions.productName %} {% include "product.html" %} {%
284-
endif %} {% if tabs|length > 0 %} {% include "tabs.html" %} {% else %}
285-
{% include "search-component-code.html" %} {% endif %}
283+
{% if params.singleProductOptions and params.singleProductOptions.productName %} {% include
284+
"product.html" %} {% endif %} {% if tabs|length > 0 %} {% include
285+
"tabs.html" %} {% else %} {% include "search-component-code.html" %} {%
286+
endif %}
286287
</div>
287288
</main>
288289
{% if logged_in %}

0 commit comments

Comments
 (0)