mirror of
https://github.com/docsifyjs/docsify.git
synced 2026-10-17 04:31:18 +08:00
fix: enhancement of isExternal (#2093)
This commit is contained in:
@@ -96,5 +96,8 @@ export function isExternal(url) {
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
if (/^\/\\/.test(url)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -59,5 +59,17 @@ describe('core/util', () => {
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
test('external url with one \\', () => {
|
||||
const result = isExternal('/\\example.github.io/docsify/demo.md');
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
test('external url with two \\', () => {
|
||||
const result = isExternal('/\\\\example.github.io/docsify/demo.md');
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user