Skip to content

Commit

Permalink
fix: link with blob not affected
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyleen77 committed Mar 4, 2024
1 parent b75ab9e commit 6a5bcf3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
9 changes: 9 additions & 0 deletions demo/app-dir/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ export default function Home() {
<Link className="a" href="tel:0000000000" rel="noopener noreferrer">
Link with tel not affected
</Link>
<a
className="a"
href="blob:http://localhost:3000/123456789"
onClick={(e) => {
e.preventDefault();
}}
>
Link with blob not affected
</a>
<a className="a">Link without href won&apos;t throw error</a>

<p
Expand Down
5 changes: 4 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-nprogress-bar",
"version": "2.3.1",
"version": "2.3.2",
"description": "NextJS progress bar compatible with new app directory",
"repository": {
"type": "git",
Expand Down
5 changes: 4 additions & 1 deletion src/AppProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ export const AppProgressBar = React.memo(
const isNProgressDisabled =
anchor.getAttribute('data-disable-nprogress') === 'true';
const isNotTelOrMailto =
href && !href.startsWith('tel:') && !href.startsWith('mailto:');
href &&
!href.startsWith('tel:') &&
!href.startsWith('mailto:') &&
!href.startsWith('blob:');

return (
!isNProgressDisabled &&
Expand Down

0 comments on commit 6a5bcf3

Please sign in to comment.