소스 검색

HUE-6566 [frontend] Prevent JS error on empty URLs for open.link

Enrico Berti 8 년 전
부모
커밋
70c37c4
1개의 변경된 파일9개의 추가작업 그리고 4개의 파일을 삭제
  1. 9 4
      desktop/core/src/desktop/templates/hue.mako

+ 9 - 4
desktop/core/src/desktop/templates/hue.mako

@@ -1036,10 +1036,15 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
         });
 
         huePubSub.subscribe('open.link', function (href) {
-          if (href.startsWith('/') && !href.startsWith('/hue')){
-            page('/hue' + href);
-          } else {
-            page(href);
+          if (href) {
+            if (href.startsWith('/') && !href.startsWith('/hue')){
+              page('/hue' + href);
+            } else {
+              page(href);
+            }
+          }
+          else {
+            console.warn('Received an open.link without href.')
           }
         });
       };