Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert "Remove leading slash of webview route ..." #6279

Merged
merged 1 commit into from
Sep 27, 2019

Conversation

AlexTugarev
Copy link
Contributor

@AlexTugarev AlexTugarev commented Sep 27, 2019

What it does

partially reverting changes from #5619 which break "html base href" logic in webview for instance in the python extension for vscode.

some vscode extensions like the python extension to load html like this into the webview:

<html lang="en">
    <head>
        <!-- ... -->
        <base href="${uriBase}"/>
    </head>
    <body>
        <!-- ... -->
    <script type="text/javascript" src="${uri}"></script></body>
</html>

using these values for vars:

const uriBasePath = Uri.file(`${path.dirname(mainScriptPath)}/`);
const uriBase = uriBasePath.with({ scheme: 'vscode-resource' });

const uriPath = Uri.file(mainScriptPath);
const uri = uriPath.with({ scheme: 'vscode-resource' });

now what happens is that after the change done in PR 5619 we end up with base href being a relative path which leads to a bogus concatenation of both URIs when the browser tries to fetch the script resource. in other words: the script resource url was webview/<path-to-resource-dir>/webview/<path-to-resource>

How to test

  • check with python extension for vscode that the "index_bundle.js" is actually loaded.

Review checklist

quickly checked that the resources are loaded in the python extension.

Screen Shot 2019-09-27 at 09 39 39

Reminder for reviewers

partially reverting changes from #5619 which break "html base href" logic in webview for instance in the python extension for vscode.

Signed-off-by: Alex Tugarev <[email protected]>
@AlexTugarev
Copy link
Contributor Author

@amiramw I discussed this with @svenefftinge and the alternative solution to run theia on a proxy path could be to replace vscode-resource:/ with ${PROXY_PATH}/webview/ where PROXY_PATH could be injected as env var.

@AlexTugarev
Copy link
Contributor Author

I'm merging this and going to open an issue for the proxy path problem from #5619

@AlexTugarev AlexTugarev merged commit 5e50106 into master Sep 27, 2019
@vince-fugnitto vince-fugnitto deleted the at/revert-pr5619-partially branch September 29, 2022 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants