15159: Hide "open in new tab" if unsafe and TrustAllContent is false
[arvados-workbench2.git] / src / views-components / context-menu / actions / helpers.ts
index dfa8d04f1d83124b27283efa857403936329bd83..159b1c189737be75fd5c942792513c31b1f54204 100644 (file)
@@ -43,4 +43,11 @@ export const getInlineFileUrl = (url: string, keepWebSvcUrl: string, keepWebInli
         inlineUrl = inlineUrl.replace(`/c=${collMatch[1]}`, '');
     }
     return inlineUrl;
-};
\ No newline at end of file
+};
+
+export const isInlineFileUrlSafe = (url: string, keepWebSvcUrl: string, keepWebInlineSvcUrl: string): boolean => {
+  let inlineUrl = keepWebInlineSvcUrl !== ""
+      ? url.replace(keepWebSvcUrl, keepWebInlineSvcUrl)
+      : url;
+  return inlineUrl.indexOf('*.') > -1;
+}