From 384a37be8c001edbc2a3d99e9a1184e07f7c48dc Mon Sep 17 00:00:00 2001 From: Michael Fix Date: Tue, 11 Aug 2020 19:40:53 -0700 Subject: [PATCH] encode asterisks for medium embeds (#1074) --- components/CopyMenu.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/CopyMenu.js b/components/CopyMenu.js index 5bfd816..fe32105 100644 --- a/components/CopyMenu.js +++ b/components/CopyMenu.js @@ -19,7 +19,9 @@ const toIFrame = (url, width, height) => ` const toURL = url => `${location.origin}${url}` -const toEncodedURL = morph.compose(encodeURI, toURL) +// Medium does not handle asterisks correctly - https://github.com/carbon-app/carbon/issues/1067 +const replaceAsterisks = string => string.replace(/\*/g, '%2A') +const toEncodedURL = morph.compose(encodeURI, replaceAsterisks, toURL) function CopyButton(props) { return (