From 182f80ce19c99dfa2eb9dfaf7730e90f35289947 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Fri, 4 May 2018 16:18:47 +0200 Subject: [PATCH] Strip out question mark and hash characters from the snippet preview URL. --- composites/Plugin/SnippetPreview/components/SnippetPreview.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/composites/Plugin/SnippetPreview/components/SnippetPreview.js b/composites/Plugin/SnippetPreview/components/SnippetPreview.js index 83bb7025..a240f2d6 100644 --- a/composites/Plugin/SnippetPreview/components/SnippetPreview.js +++ b/composites/Plugin/SnippetPreview/components/SnippetPreview.js @@ -440,7 +440,9 @@ export default class SnippetPreview extends PureComponent { */ getBreadcrumbs() { const { url, breadcrumbs } = this.props; - const { protocol, hostname, pathname } = parse( url ); + // Strip out question mark and hash characters from the raw URL. + const cleanUrl = url.replace( /\?|#/g, "" ); + const { protocol, hostname, pathname } = parse( cleanUrl ); const hostPart = protocol === "https:" ? protocol + "//" + hostname : hostname;