Skip to content

Commit

Permalink
fix: enhancement of isExternal (#2093)
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records authored Jun 18, 2023
1 parent 46333ed commit 7f13ba0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/util/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,8 @@ export function isExternal(url) {
) {
return true;
}
if (/^\/\\/.test(url)) {
return true;
}
return false;
}
12 changes: 12 additions & 0 deletions test/unit/core-util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
});

1 comment on commit 7f13ba0

@vercel
Copy link

@vercel vercel bot commented on 7f13ba0 Jun 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.