From 788e852a49dc5d451c74a6f124bcddc27ffc8c19 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFs=20Poujade?= <lois.poujade@tetras-libre.fr>
Date: Tue, 14 Jun 2022 11:18:36 +0200
Subject: [PATCH] Open file instead of preview icon, in annotation popup

Closes #7
---
 capsule-prototype/js/PopupPanelWidget.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/capsule-prototype/js/PopupPanelWidget.js b/capsule-prototype/js/PopupPanelWidget.js
index cd588f0..83e0f66 100644
--- a/capsule-prototype/js/PopupPanelWidget.js
+++ b/capsule-prototype/js/PopupPanelWidget.js
@@ -851,11 +851,12 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) {
             .attr('id', 'popupImgBox');
 
         let image = $('<img src="" alt="">');
+        let fileDirectLink = this.getDownloadLink();
         if (this.isMarker()) {
             image.attr('src', "../shared/css/images/img-note.png");
         } else {
             if (this.thumbnail.url) {
-                image.attr("src", this.getDownloadLink() || this.thumbnail.url);
+                image.attr("src", fileDirectLink || this.thumbnail.url);
             } else {
                 let type = this.getMetadata("Rekall->Type");
                 if (type.indexOf("image") > -1) image.attr("src", "../shared/css/images/img-image.png")
@@ -875,7 +876,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) {
                     if (that.isLink()) {
                         if (that.getMetadata("Rekall->Link")) window.open(that.getMetadata("Rekall->Link"), '_blank')
                     } else {
-                        window.open(image.attr('src'), '_blank');
+                        window.open(fileDirectLink, '_blank');
                     }
                 });
         }
-- 
GitLab