Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this regex change will have the desired effect but what if we updated it to keep in the same style as before? Something like
rewrite ^/static/(version[\w\d]*/)?(.*)$ /static/$2 last;
this would then match any word or digit character. Or was there another reason for your choice @scottsbThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of the fact that the version can be specified as a command line argument and no characters are filtered out, I don't think
\w\d
is sufficient. For example, that would not match a hyphen, which is allowed by the--content-version
argument.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know if there is validation on the
--content-version
call? I would worry that anything but / would be a bit too wide and could cause issues.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no validation. Whatever is passed in is used:
magento2/app/code/Magento/Deploy/Service/DeployStaticContent.php
Line 78 in 2275b89
I tested, and it will even accept characters that really shouldn't be allowed like
/
and even?
. Validation should be added to the deploy command to block those, but here in nginx, I can't see any issue with the broad match.I'll open a separate issue for the need for validation on the command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback @scottsb good to know that you will open an issue about validation on the command side. I would also suggest that in this new issue it might be a good idea to also update the regex to fit the requirements of the new validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the great discussion and feedback @dmanners and @scottsb. I will process this PR then.