che icon indicating copy to clipboard operation
che copied to clipboard

Opening links doesn't work in the Che-Code editor

Open RomanNikitenko opened this issue 1 year ago • 4 comments

Describe the bug

It's not possible to open a link in the Che-Code editor.

Che version

7.86@latest

Steps to reproduce

Click on a link of a md file (just for example, you can try another way to test it) => nothing happens = a new tab is not opened

Expected behavior

Opening links should work for the Che-Code editor

Runtime

I was able to reproduce the problem on the dogfooding instance

RomanNikitenko avatar May 28 '24 10:05 RomanNikitenko

Command related links also don't work in the editor:

screencast-che-dogfooding.apps.che-dev.x6e0.p1.openshiftapps.com-2024.08.30-13_58_47.webm

svor avatar Aug 30 '24 11:08 svor

It looks like it depends on cross-domain secutiry policy. Normally the webview static resources are loaded from the CDN https://github.com/che-incubator/che-code/blob/main/code/product.json#L34 which has a different domain.

Having a quick debug I see the clicking the link is blocked somewhere under the hood ( it needs the additional investigation ).

As a workaround it is possible to configure webview resources to be loaded from the current cluster. To do that it needs to define WEBVIEW_LOCAL_RESOURCES environment variable for the tools container and restart the workspace from local devfile.

components:
  - name: tools
    container:
      image: registry.redhat.io/devspaces/udi-rhel8:3.15
      endpoints:
        - exposure: public
          name: nodejs
          protocol: https
          targetPort: 3000
      env:
        - name: WEBVIEW_LOCAL_RESOURCES
          value: "true"
      memoryLimit: '1Gi'
      memoryRequest: '512Mi'
      cpuLimit: '0.5'
      cpuRequest: '0.25'
      mountSources: true
      volumeMounts:
        - name: npm
          path: /home/user/.npm

vitaliy-guliy avatar Sep 05 '24 09:09 vitaliy-guliy

Reopening it as the webviews do not work when static resources were taken from the same domain as editor and the browser do not trust self-signed certificate.

vitaliy-guliy avatar Sep 24 '24 07:09 vitaliy-guliy