From 5046cf399e350b97f43114d112df419166144b7e Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Mon, 15 Jul 2024 21:16:29 -0700 Subject: [PATCH] Add/allow import site gutenberg pr (#1610) ## Motivation for the change, related issues This is related to supporting visual regression testing of Gutenberg PRs with Playground. https://github.com/WordPress/gutenberg/pull/62729 Importing content into a Playground makes testing easier. This will allow the supported `import-site` parameter to be used on this page as well. ## Implementation details This change adds a check for a the `import-site` query parameter and adds a step to the blueprint when it is found. The link has minimal validation, but I don't believe this creates a significant security concern. In theory someone could corrupt the blueprint by directing people to this URL with a malformed query parameter. Validating that the parameter is a URL, and not passing the query string or hash seemed to mitigate the most obvious offenses. ## Testing Instructions (or ideally a Blueprint) 1. Run locally 2. Visit `gutenberg.html` with a query parameter `import-site` pointing to a valid Playground ZIP import. 3. Confirm that Playground has imported content from ZIP file. --- .../playground/website/public/gutenberg.html | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/playground/website/public/gutenberg.html b/packages/playground/website/public/gutenberg.html index b6e886c023..eeabee76c6 100644 --- a/packages/playground/website/public/gutenberg.html +++ b/packages/playground/website/public/gutenberg.html @@ -1,4 +1,5 @@ + Gutenberg PR Previewer @@ -34,6 +35,7 @@ gtag('config', 'G-SVTNFCP8T7'); +