Skip to content

Conversation

@adamziel
Copy link
Collaborator

Motivation for the change, related issues

@bcotrim reported a problem with random empty folders showing up in wp-content when creating sites from a specific Blueprint:

image

The problem was with the installAsset() function calling randomString() to generate filenames. Sometimes the resulting string would contain a slash, which would create a subdirectory structure. After the asset is processed, only the subdirectory would be cleaned up, leaving the parent directory unchanged.

Implementation details

This PR replaces the randomString() call with a randomFilename() call. It uses the same randomizer, but it restrict the set of special characters to just - and _.

Testing Instructions (or ideally a Blueprint)

Run this Blueprint with a local Playground CLI or Playground web and confirm that, after it's finished, there are no random-looking directories inside wp-content. Repeat this test a few times for a good measure.

cc @bcotrim @brandonpayton @wojtekn @JanJakes @akirk

@adamziel adamziel added [Type] Bug An existing feature does not function as intended [Package][@wp-playground] Blueprints labels Sep 23, 2025
@adamziel adamziel merged commit e71c153 into trunk Sep 23, 2025
26 of 27 checks passed
@adamziel adamziel deleted the fix-random-directories branch September 23, 2025 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package][@wp-playground] Blueprints [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants