Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Coder
code-server
提交
a89d83cb
C
code-server
项目概览
镜像
/
Coder
/
code-server
2022-09-21 03:15:05同步失败
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
code-server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a89d83cb
编写于
10月 28, 2019
作者:
A
Asher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix other incorrect usages of `split`
上级
83ff31b6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
10 deletion
+19
-10
src/browser/client.ts
src/browser/client.ts
+4
-3
src/common/util.ts
src/common/util.ts
+10
-0
src/node/server.ts
src/node/server.ts
+5
-7
未找到文件。
src/browser/client.ts
浏览文件 @
a89d83cb
...
...
@@ -3,15 +3,16 @@ import { URI } from "vs/base/common/uri";
import
{
registerSingleton
}
from
"
vs/platform/instantiation/common/extensions
"
;
import
{
ServiceCollection
}
from
"
vs/platform/instantiation/common/serviceCollection
"
;
import
{
ILocalizationsService
}
from
"
vs/platform/localizations/common/localizations
"
;
import
{
LocalizationsService
}
from
"
vs/workbench/services/localizations/electron-browser/localizationsService
"
;
import
{
PersistentConnectionEventType
}
from
"
vs/platform/remote/common/remoteAgentConnection
"
;
import
{
ITelemetryService
}
from
"
vs/platform/telemetry/common/telemetry
"
;
import
{
coderApi
,
vscodeApi
}
from
"
vs/server/src/browser/api
"
;
import
{
IUploadService
,
UploadService
}
from
"
vs/server/src/browser/upload
"
;
import
{
INodeProxyService
,
NodeProxyChannelClient
}
from
"
vs/server/src/common/nodeProxy
"
;
import
{
TelemetryChannelClient
}
from
"
vs/server/src/common/telemetry
"
;
import
{
split
}
from
"
vs/server/src/common/util
"
;
import
"
vs/workbench/contrib/localizations/browser/localizations.contribution
"
;
import
{
LocalizationsService
}
from
"
vs/workbench/services/localizations/electron-browser/localizationsService
"
;
import
{
IRemoteAgentService
}
from
"
vs/workbench/services/remote/common/remoteAgentService
"
;
import
{
PersistentConnectionEventType
}
from
"
vs/platform/remote/common/remoteAgentConnection
"
;
class
TelemetryService
extends
TelemetryChannelClient
{
public
constructor
(
...
...
@@ -79,7 +80,7 @@ export const withQuery = (url: string, replace: Query): string => {
const
uri
=
URI
.
parse
(
url
);
const
query
=
{
...
replace
};
uri
.
query
.
split
(
"
&
"
).
forEach
((
kv
)
=>
{
const
[
key
,
value
]
=
kv
.
split
(
"
=
"
,
2
);
const
[
key
,
value
]
=
split
(
kv
,
"
=
"
);
if
(
!
(
key
in
query
))
{
query
[
key
]
=
value
;
}
...
...
src/common/util.ts
0 → 100644
浏览文件 @
a89d83cb
/**
* Split a string up to the delimiter. If the delimiter doesn't exist the first
* item will have all the text and the second item will be an empty string.
*/
export
const
split
=
(
str
:
string
,
delimiter
:
string
):
[
string
,
string
]
=>
{
const
index
=
str
.
indexOf
(
delimiter
);
return
index
!==
-
1
?
[
str
.
substring
(
0
,
index
).
trim
(),
str
.
substring
(
index
+
1
)]
:
[
str
,
""
];
};
src/node/server.ts
浏览文件 @
a89d83cb
...
...
@@ -56,6 +56,7 @@ import { resolveCommonProperties } from "vs/platform/telemetry/node/commonProper
import
{
UpdateChannel
}
from
"
vs/platform/update/electron-main/updateIpc
"
;
import
{
INodeProxyService
,
NodeProxyChannel
}
from
"
vs/server/src/common/nodeProxy
"
;
import
{
TelemetryChannel
}
from
"
vs/server/src/common/telemetry
"
;
import
{
split
}
from
"
vs/server/src/common/util
"
;
import
{
ExtensionEnvironmentChannel
,
FileProviderChannel
,
NodeProxyService
}
from
"
vs/server/src/node/channel
"
;
import
{
Connection
,
ExtensionHostConnection
,
ManagementConnection
}
from
"
vs/server/src/node/connection
"
;
import
{
TelemetryClient
}
from
"
vs/server/src/node/insights
"
;
...
...
@@ -212,8 +213,8 @@ export abstract class Server {
}
protected
withBase
(
request
:
http
.
IncomingMessage
,
path
:
string
):
string
{
const
split
=
request
.
url
?
request
.
url
.
split
(
"
?
"
,
2
)
:
[];
return
`
${
this
.
protocol
}
://
${
request
.
headers
.
host
}${
this
.
options
.
basePath
}${
path
}${
split
.
length
===
2
?
`?
${
split
[
1
]
}
`
:
""
}
`
;
const
[,
query
]
=
request
.
url
?
split
(
request
.
url
,
"
?
"
)
:
[];
return
`
${
this
.
protocol
}
://
${
request
.
headers
.
host
}${
this
.
options
.
basePath
}${
path
}${
query
?
`?
${
query
}
`
:
""
}
`
;
}
private
isAllowedRequestPath
(
path
:
string
):
boolean
{
...
...
@@ -440,11 +441,8 @@ export abstract class Server {
const
cookies
:
{
[
key
:
string
]:
string
}
=
{};
if
(
request
.
headers
.
cookie
)
{
request
.
headers
.
cookie
.
split
(
"
;
"
).
forEach
((
keyValue
)
=>
{
// key=value -> { [key]: value } and key -> { [key]: "" }
const
index
=
keyValue
.
indexOf
(
"
=
"
);
const
key
=
keyValue
.
substring
(
0
,
index
).
trim
();
const
value
=
keyValue
.
substring
(
index
+
1
);
cookies
[
key
||
value
]
=
decodeURI
(
key
?
value
:
""
);
const
[
key
,
value
]
=
split
(
keyValue
,
"
=
"
);
cookies
[
key
]
=
decodeURI
(
value
);
});
}
return
cookies
as
T
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录