mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 13:09:00 +00:00
(search) Fix acknowledgement page for domain complaints rendering as plain text
This was caused by incorrect usage of the renderInto() function, which was always buggy and should never be used. This method is removed with this change.
This commit is contained in:
parent
bd7970fb1f
commit
f592c9f04d
@ -49,14 +49,6 @@ public class MustacheRenderer<T> {
|
||||
return template.apply(model);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public Object renderInto(Response response, T model) {
|
||||
|
||||
response.raw().getOutputStream().write(template.apply(model).getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public <T2> String render(T model, String name, List<T2> children) {
|
||||
Context ctx = Context.newBuilder(model).combine(name, children).build();
|
||||
@ -70,9 +62,4 @@ public class MustacheRenderer<T> {
|
||||
return template.apply(ctx);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public void renderInto(Response response, T model, Map<String, ?> children) {
|
||||
Context ctx = Context.newBuilder(model).combine(children).build();
|
||||
response.raw().getOutputStream().write(template.apply(ctx).getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
|
@ -60,8 +60,6 @@ public class SearchSiteInfoService {
|
||||
String domainName = request.params("site");
|
||||
String view = request.queryParamOrDefault("view", "info");
|
||||
|
||||
response.type("text/html");
|
||||
|
||||
if (null == domainName || domainName.isBlank()) {
|
||||
return null;
|
||||
}
|
||||
@ -76,7 +74,7 @@ public class SearchSiteInfoService {
|
||||
default -> listInfo(ctx, domainName);
|
||||
};
|
||||
|
||||
return renderer.renderInto(response, model);
|
||||
return renderer.render(model);
|
||||
}
|
||||
|
||||
public Object handlePost(Request request, Response response) throws SQLException {
|
||||
@ -104,7 +102,7 @@ public class SearchSiteInfoService {
|
||||
|
||||
var model = new ReportDomain(domainName, domainId, complaints, List.of(), true);
|
||||
|
||||
return renderer.renderInto(response, model);
|
||||
return renderer.render(model);
|
||||
}
|
||||
|
||||
private Object reportSite(Context ctx, String domainName) throws SQLException {
|
||||
|
Loading…
Reference in New Issue
Block a user