Skip to content

Commit 602e06e

Browse files
authored
Merge pull request #4811 from easyops-cn/williamcai/brick-kit/Router/ignore_blacklist_paths_of_external_link
fix(Router): ignore blacklist paths of external link
2 parents 52b5108 + 6abba07 commit 602e06e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/brick-kit/src/core/Router.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,9 @@ describe("Router", () => {
909909
{
910910
url: "/next/blocked-app/blocked-path-2",
911911
},
912+
{
913+
url: "http://aaa.com",
914+
},
912915
{
913916
to: {} as unknown as string,
914917
},
@@ -954,6 +957,8 @@ describe("Router", () => {
954957
expect(spyOnAddPathToBlackList).toBeCalledWith(
955958
"/blocked-app/blocked-path-2"
956959
);
960+
expect(spyOnAddPathToBlackList).not.toBeCalledWith("http://aaa.com");
961+
957962
expect(spyOnIsBlockedPath).toBeCalledWith("/blocked-app/blocked-path-2");
958963

959964
spyOnComputeRealValue.mockReset();

packages/brick-kit/src/core/Router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ export class Router {
344344
path = path.replace(/^\/next\//, "/");
345345
}
346346

347-
path && addPathToBlackList(path);
347+
path && path.startsWith("/") && addPathToBlackList(path);
348348
});
349349

350350
if (isBlockedPath(location.pathname)) {

0 commit comments

Comments
 (0)