don't use prism for big binaries when rendering library

This commit is contained in:
Grahame Grieve 2020-11-05 14:11:18 +11:00
parent 2c22d8fa23
commit 49cf605b06
1 changed files with 5 additions and 1 deletions

View File

@ -401,7 +401,7 @@ public class LibraryRenderer extends ResourceRenderer {
p.code().tx(att.getContentType()+lang(att));
}
String prismCode = determinePrismCode(att);
if (prismCode != null) {
if (prismCode != null && !tooBig(txt)) {
x.pre().code().setAttribute("class", "language-"+prismCode).tx(txt);
} else {
x.pre().code().tx(txt);
@ -420,6 +420,10 @@ public class LibraryRenderer extends ResourceRenderer {
}
}
private boolean tooBig(String txt) {
return txt.length() > 16384;
}
private String imgExtension(String contentType) {
if (contentType != null && contentType.startsWith("image/")) {
if (contentType.startsWith("image/png")) {