Skip to content

Commit

Permalink
Fix Python help url resolution on Server Web and Workbench (#4837)
Browse files Browse the repository at this point in the history
### Description
- addresses part of #4274
- a follow-up to #4814 to fix
Python help docs in Positron Server and Positron on Workbench

#### Screenshots of the issue

<img width="865" alt="image"
src="https://github.com/user-attachments/assets/631488c4-cee6-49ec-8c9a-314830c925e7">


![image](https://github.com/user-attachments/assets/b0594155-f357-46e6-8a61-4a3ac211f600)

#### What it looks like now!

<img width="1727" alt="image"
src="https://github.com/user-attachments/assets/313a33a1-4698-47ac-8df2-314a6cc034df">

#### Implementation Notes
- adds back in the `sourceUrl.pathname` fix that I should have had in
#4814, but accidentally deleted
- appends the search query to the target path, which was getting dropped
in the proxied request in `src/vs/server/node/webClientServer.ts`

Note: the change to `src/vs/server/node/webClientServer.ts` needs to be
contributed to our upstream.

### QA Notes
In Positron Server Web and Positron on Workbench:

1. Select a Python interpreter
2. In the Console, get help for something, e.g. `import time` then
`?time` and hit Enter
3. What to expect in the Help Pane:
- the pane should display the help content with styling that matches the
current IDE theme
    - links to other help pages should load and work when clicked
- there shouldn't be 404 Not Found errors in the Developer Console or
Network tab for paths referenced in the help HTML

---------

Co-authored-by: Brian Lambert <brianlambert@gmail.com>
Co-authored-by: Jonathan <jonathan@rstudio.com>
  • Loading branch information
3 people authored Sep 30, 2024
1 parent 8274fe2 commit e51332d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
12 changes: 4 additions & 8 deletions build/secrets/.secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": "build/secrets/.secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
},
{
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
},
Expand Down Expand Up @@ -905,23 +901,23 @@
"filename": "src/vs/server/node/webClientServer.ts",
"hashed_secret": "66e26ed510af41f1d322d1ebda4389302f4a03c7",
"is_verified": false,
"line_number": 445,
"line_number": 450,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "src/vs/server/node/webClientServer.ts",
"hashed_secret": "f769de45d1747b634dfe3d7eb842f6967c4c5e98",
"is_verified": false,
"line_number": 445,
"line_number": 450,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "src/vs/server/node/webClientServer.ts",
"hashed_secret": "93f2efffc36c6e096cdb21d6aadb7087dc0d7478",
"is_verified": false,
"line_number": 452,
"line_number": 457,
"is_secret": false
}
],
Expand Down Expand Up @@ -1912,5 +1908,5 @@
}
]
},
"generated_at": "2024-09-11T23:58:52Z"
"generated_at": "2024-09-26T21:49:10Z"
}
7 changes: 6 additions & 1 deletion src/vs/server/node/webClientServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ export class WebClientServer {
}
// --- PWB Start: Server proxy support ---
if (kProxyRegex.test(pathname)) {
const path: string = pathname.replace('/proxy/', 'http://0.0.0.0:');
let path: string = pathname.replace('/proxy/', 'http://0.0.0.0:');

// Append query string if it exists
if (parsedUrl.search) {
path = path.concat(parsedUrl.search);
}

return this._proxyServer.web(req, res, {
ignorePath: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { localize } from 'vs/nls';
import { FileAccess } from 'vs/base/common/network';
import { join } from 'vs/base/common/path';
import { Emitter, Event } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { ILogService } from 'vs/platform/log/common/log';
Expand Down Expand Up @@ -649,6 +650,7 @@ class PositronHelpService extends Disposable implements IPositronHelpService {
sourceUrl.protocol = proxyServerOriginUrl.protocol;
sourceUrl.hostname = proxyServerOriginUrl.hostname;
sourceUrl.port = proxyServerOriginUrl.port;
sourceUrl.pathname = join(proxyServerOriginUrl.pathname, targetUrl.pathname);

// Basically this can't happen.
if (!session) {
Expand Down

0 comments on commit e51332d

Please sign in to comment.