Skip to content

Commit

Permalink
wp-env: Allow .zip source URLs with query parameters (#43200)
Browse files Browse the repository at this point in the history
Add optional capture group to url regex in wp-env's .zip source logic to 
download .zip's from URLs with query parameters.

Co-authored-by: Titus Moore <[email protected]>
  • Loading branch information
titusdmoore and tmoore-edge authored Aug 16, 2022
1 parent 0b0f9e2 commit d0220ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/env/lib/config/parse-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function parseSourceString( sourceString, { workDirectoryPath } ) {
}

const zipFields = sourceString.match(
/^https?:\/\/([^\s$.?#].[^\s]*)\.zip$/
/^https?:\/\/([^\s$.?#].[^\s]*)\.zip(\?.+)?$/
);

if ( zipFields ) {
Expand Down
9 changes: 9 additions & 0 deletions packages/env/lib/config/test/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ describe( 'readConfig', () => {
plugins: [
'https://www.example.com/test/path/to/gutenberg.zip',
'https://www.example.com/test/path/to/gutenberg.8.1.0.zip',
'https://www.example.com/test/path/to/gutenberg.8.1.0.zip?auth=thisIsAString&token=secondString',
'https://www.example.com/test/path/to/twentytwenty.zip',
'https://www.example.com/test/path/to/twentytwenty.1.3.zip',
'https://example.com/twentytwenty.1.3.zip',
Expand All @@ -550,6 +551,14 @@ describe( 'readConfig', () => {
),
basename: 'gutenberg.8.1.0',
},
{
type: 'zip',
url: 'https://www.example.com/test/path/to/gutenberg.8.1.0.zip?auth=thisIsAString&token=secondString',
path: expect.stringMatching(
/^(\/|\\).*gutenberg.8.1.0$/
),
basename: 'gutenberg.8.1.0',
},
{
type: 'zip',
url: 'https://www.example.com/test/path/to/twentytwenty.zip',
Expand Down

0 comments on commit d0220ea

Please sign in to comment.