Skip to content

Commit

Permalink
Handle null mime in document info dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
simon987 committed Aug 29, 2020
1 parent 9568e25 commit 5da6c14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions src/static/js/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,21 @@ function makeUserTag(tag, hit) {
function infoButtonCb(hit) {
return () => {
getDocumentInfo(hit["_id"]).then(doc => {
$("#modal-body").empty()

$("#modal-title").text(doc["name"] + ext(hit));

const mimeCategory = doc["mime"].split("/")[0];
const imgWrapper = document.createElement("div");
imgWrapper.setAttribute("style", "position: relative");
imgWrapper.setAttribute("class", "img-wrapper");
makeThumbnail(mimeCategory, hit, imgWrapper, false);
if (doc["mime"]) {
const mimeCategory = doc["mime"].split("/")[0];
const imgWrapper = document.createElement("div");
imgWrapper.setAttribute("style", "position: relative");
imgWrapper.setAttribute("class", "img-wrapper");
makeThumbnail(mimeCategory, hit, imgWrapper, false);
$("#modal-body").append(imgWrapper);
}

const tbody = $("<tbody>");
$("#modal-body").empty()
.append(imgWrapper)
$("#modal-body")
.append($("<table class='table table-sm'>")
.append($("<thead>")
.append($("<tr>")
Expand Down
2 changes: 1 addition & 1 deletion src/web/static_generated.c

Large diffs are not rendered by default.

0 comments on commit 5da6c14

Please sign in to comment.