Skip to content

Commit

Permalink
Add regexp check for image link origin
Browse files Browse the repository at this point in the history
  • Loading branch information
Kielx committed Jul 2, 2022
1 parent e7652c8 commit 2bdefcf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/PopupTerminalWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,22 @@ export default function PopupTerminalWindow({
{(link = popupLiveLink || popupGithubLink) ? ( // eslint-disable-line no-cond-assign
<a href={link} target="_blank" rel="noopener noreferrer">
<img
src={`/${popupImageSrc}`}
src={`${
/^https/.test(popupImageSrc)
? popupImageSrc
: "/" + popupImageSrc
}`}
className="popupTerminaWindowImage"
alt={popupImageAlt}
></img>
</a>
) : (
<img
src={`/${popupImageSrc}`}
src={`${
/^https/.test(popupImageSrc)
? popupImageSrc
: "/" + popupImageSrc
}`}
className="popupTerminaWindowImage"
alt={popupImageAlt}
></img>
Expand Down

0 comments on commit 2bdefcf

Please sign in to comment.