Эх сурвалжийг харах

HUE-6571 [frontend] Improve reliability of openInHue4 JS

Enrico Berti 8 жил өмнө
parent
commit
e1e70913a8

+ 10 - 2
desktop/core/src/desktop/static/desktop/js/document/hueFileEntry.js

@@ -554,12 +554,20 @@ var HueFileEntry = (function () {
 
   HueFileEntry.prototype.openExternalLink = function (entry, event) {
     event.preventDefault();
-    location.href = $(event.target).attr('href');
+    var $target = $(event.target);
+    if (!$target.is('a')) {
+      $target = $target.closest('a');
+    }
+    location.href = $target.attr('href');
   };
 
   HueFileEntry.prototype.openHue4Link = function (entry, event) {
     event.preventDefault();
-    huePubSub.publish('open.link', $(event.target).attr('href'));
+    var $target = $(event.target);
+    if (!$target.is('a')) {
+      $target = $target.closest('a');
+    }
+    huePubSub.publish('open.link', $target.attr('href'));
   };
 
   HueFileEntry.prototype.showRestoreConfirmation = function () {