Skip to content

Conversation

smithjw1
Copy link
Contributor

Motivation for the change, related issues

This is related to supporting visual regression testing of Gutenberg PRs with Playground.
WordPress/gutenberg#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.
@bgrgicak bgrgicak merged commit 5046cf3 into WordPress:trunk Jul 16, 2024
@bgrgicak
Copy link
Collaborator

Thank you @smithjw1, the PR looks good!

@smithjw1 smithjw1 deleted the add/allow-import-site-gutenberg-pr branch July 16, 2024 16:23
@adamziel
Copy link
Collaborator

adamziel commented Jul 16, 2024

@smithjw1 what's the use-case for this vs including that step in the provided Blueprint before redirecting to gutenberg.html?

@smithjw1
Copy link
Contributor Author

I'm not sure I understand the question. My understanding of this page is that it builds a blueprint, encodes it into a URL, and redirects you to a Playground with that blueprint.

I didn't see a way in the code to get just the blueprint itself as something to be manipulated.

@adamziel
Copy link
Collaborator

@smithjw1 aha, I got confused here. Thank you for explaining!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants