Handle null mime in document info dialog

This commit is contained in:
simon987 2020-08-29 10:33:35 -04:00
parent 9568e25f84
commit 5da6c1488b
2 changed files with 12 additions and 8 deletions

View File

@ -195,17 +195,21 @@ function makeUserTag(tag, hit) {
function infoButtonCb(hit) { function infoButtonCb(hit) {
return () => { return () => {
getDocumentInfo(hit["_id"]).then(doc => { getDocumentInfo(hit["_id"]).then(doc => {
$("#modal-body").empty()
$("#modal-title").text(doc["name"] + ext(hit)); $("#modal-title").text(doc["name"] + ext(hit));
const mimeCategory = doc["mime"].split("/")[0]; if (doc["mime"]) {
const imgWrapper = document.createElement("div"); const mimeCategory = doc["mime"].split("/")[0];
imgWrapper.setAttribute("style", "position: relative"); const imgWrapper = document.createElement("div");
imgWrapper.setAttribute("class", "img-wrapper"); imgWrapper.setAttribute("style", "position: relative");
makeThumbnail(mimeCategory, hit, imgWrapper, false); imgWrapper.setAttribute("class", "img-wrapper");
makeThumbnail(mimeCategory, hit, imgWrapper, false);
$("#modal-body").append(imgWrapper);
}
const tbody = $("<tbody>"); const tbody = $("<tbody>");
$("#modal-body").empty() $("#modal-body")
.append(imgWrapper)
.append($("<table class='table table-sm'>") .append($("<table class='table table-sm'>")
.append($("<thead>") .append($("<thead>")
.append($("<tr>") .append($("<tr>")

File diff suppressed because one or more lines are too long