Skip to content

Commit 8baf0e1

Browse files
committed
Fix issues surrounding relative paths.
1 parent e5b38cf commit 8baf0e1

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/vs/server/remoteExtensionHostAgentServer.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import * as crypto from 'crypto';
77
import * as fs from 'fs';
8+
import * as path from 'path';
89
import * as http from 'http';
910
import * as net from 'net';
1011
import * as url from 'url';
@@ -400,20 +401,22 @@ export class RemoteExtensionHostAgentServer extends Disposable {
400401
return this._webClientServer.serveError(req, res, 400, `Bad request.`);
401402
}
402403

404+
const parsedPath = path.parse(pathname);
405+
403406
// Version
404-
if (pathname === '/version') {
407+
if (parsedPath.base === 'version') {
405408
res.writeHead(200, { 'Content-Type': 'text/plain' });
406409
return res.end(this._productService.commit || '');
407410
}
408411

409412
// Delay shutdown
410-
if (pathname === '/delay-shutdown') {
413+
if (parsedPath.base === 'delay-shutdown') {
411414
this._delayShutdown();
412415
res.writeHead(200);
413416
return res.end('OK');
414417
}
415418

416-
if (pathname === '/vscode-remote-resource') {
419+
if (parsedPath.base === 'vscode-remote-resource') {
417420
// Handle HTTP requests for resources rendered in the rich client (images, fonts, etc.)
418421
// These resources could be files shipped with extensions or even workspace files.
419422
if (parsedUrl.query['tkn'] !== this._connectionToken) {

src/vs/server/webClientServer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ export class WebClientServer {
115115
return this._handleStatic(req, res, parsedUrl);
116116
}
117117

118-
if (parsedPath.base === '/callback') {
118+
if (parsedPath.base === 'callback') {
119119
// callback support
120120
return this._handleCallback(req, res, parsedUrl);
121121
}
122122

123-
if (parsedPath.base === '/fetch-callback') {
123+
if (parsedPath.base === 'fetch-callback') {
124124
// callback fetch support
125125
return this._handleFetchCallback(req, res, parsedUrl);
126126
}

0 commit comments

Comments
 (0)