Skip to content

Commit 7f13ba0

Browse files
authoredJun 18, 2023
fix: enhancement of isExternal (#2093)
1 parent 46333ed commit 7f13ba0

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
 

‎src/core/util/core.js

+3
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,8 @@ export function isExternal(url) {
9696
) {
9797
return true;
9898
}
99+
if (/^\/\\/.test(url)) {
100+
return true;
101+
}
99102
return false;
100103
}

‎test/unit/core-util.test.js

+12
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,17 @@ describe('core/util', () => {
5959

6060
expect(result).toBeTruthy();
6161
});
62+
63+
test('external url with one \\', () => {
64+
const result = isExternal('/\\example.github.io/docsify/demo.md');
65+
66+
expect(result).toBeTruthy();
67+
});
68+
69+
test('external url with two \\', () => {
70+
const result = isExternal('/\\\\example.github.io/docsify/demo.md');
71+
72+
expect(result).toBeTruthy();
73+
});
6274
});
6375
});

1 commit comments

Comments
 (1)
Please sign in to comment.