Navigation Menu

Skip to content

Commit

Permalink
fix: Protect against redirecting back to the same doc
Browse files Browse the repository at this point in the history
closes #975
  • Loading branch information
tommoor committed Oct 16, 2019
1 parent b093acd commit 97c8bfc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/components/Editor/Editor.js
Expand Up @@ -52,7 +52,11 @@ class Editor extends React.Component<Props> {
}
}

this.redirectTo = navigateTo;
// protect against redirecting back to the same place
const currentLocation = window.location.pathname + window.location.hash;
if (currentLocation !== navigateTo) {
this.redirectTo = navigateTo;
}
} else {
window.open(href, '_blank');
}
Expand Down

0 comments on commit 97c8bfc

Please sign in to comment.