Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit00903f6

Browse files
knagaitsevevilebottnawi
authored andcommitted
fix: scriptHost in client (#2246)
1 parent5f9dde9 commit00903f6

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

‎client-src/default/utils/createSocketUrl.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ function createSocketUrl(resourceQuery) {
1616
// Else, get the url from the <script> this file was called with.
1717
letscriptHost=getCurrentScriptSource();
1818

19-
// eslint-disable-next-line no-useless-escape
20-
scriptHost=scriptHost.replace(/\/[^\/]+$/,'');
19+
if(scriptHost){
20+
// eslint-disable-next-line no-useless-escape
21+
scriptHost=scriptHost.replace(/\/[^\/]+$/,'');
22+
}
2123
urlParts=url.parse(scriptHost||'/',false,true);
2224
}
2325

‎test/client/utils/__snapshots__/createSocketUrl.test.js.snap‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ exports[`createSocketUrl should return the url when __resourceQuery is https://e
1616

1717
exports[`createSocketUrl should return the url when __resourceQuery is https://localhost:123 1`]=`"ttps:localhost:123/sockjs-node"`;
1818

19+
exports[`createSocketUrl should return the url when __resourceQuery is undefined 1`]=`"/sockjs-node"`;
20+
1921
exports[`createSocketUrl should return the url when the current script source is ?test 1`]=`"/sockjs-node"`;
2022

2123
exports[`createSocketUrl should return the url when the current script source is http://0.0.0.0 1`]=`"http:/sockjs-node"`;
@@ -31,3 +33,5 @@ exports[`createSocketUrl should return the url when the current script source is
3133
exports[`createSocketUrl should return the url when the current script source is https://example.com/path/foo.js 1`]=`"https://example.com/sockjs-node"`;
3234

3335
exports[`createSocketUrl should return the url when the current script source is https://localhost:123 1`]=`"https:/sockjs-node"`;
36+
37+
exports[`createSocketUrl should return the url when the current script source is undefined 1`]=`"/sockjs-node"`;

‎test/client/utils/createSocketUrl.test.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ describe('createSocketUrl', () => {
1313
// TODO: comment out after the major release
1414
// https://github.com/webpack/webpack-dev-server/pull/1954#issuecomment-498043376
1515
// 'file://filename',
16+
// eslint-disable-next-line no-undefined
17+
undefined,
1618
];
1719

1820
samples.forEach((url)=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp