Skip to content

Commit

Permalink
BUGFIX: Prevent opening relative urls in new tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebobo committed Feb 15, 2023
1 parent 6ea0920 commit c4b1ab0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/commandbar/src/state/CommandBarInputProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const CommandBarInputProvider: React.FC<CommandInputContextProps> = ({ ch

// We need to check if the url is in the same domain, otherwise we need to open it in a new tab
// TODO: We should add another option to a link command to define its target
if (action.indexOf(document.location.origin) !== 0) {
if (action.indexOf('http') === 0 && action.indexOf(document.location.origin) !== 0) {
window.open(action, '_blank', 'noopener,noreferrer')?.focus();
} else {
window.location.href = action;
Expand Down

0 comments on commit c4b1ab0

Please sign in to comment.