fix: preserve hyphenated values in custom Docker run options parser#9497
Open
jeongkichang wants to merge 1 commit intocoollabsio:nextfrom
Open
fix: preserve hyphenated values in custom Docker run options parser#9497jeongkichang wants to merge 1 commit intocoollabsio:nextfrom
jeongkichang wants to merge 1 commit intocoollabsio:nextfrom
Conversation
The regex in convertDockerRunToCompose() used [^\s-]+ for the value capture group, which excluded hyphens from matched values. This caused options like --security-opt no-new-privileges:true to be truncated to just "no", resulting in deployment failures. Change the value capture group from ([^\s-]+)? to ((?!--)[^\s]+)? so hyphens within values are preserved while --flag boundaries are still correctly detected via negative lookahead.
Member
|
Can you share the steps to test this without running those test files? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes
The regex in
convertDockerRunToCompose()(bootstrap/helpers/docker.php:994) used[^\s-]+for the value capture group, which excluded hyphens from matched values. This caused options like--security-opt no-new-privileges:trueto be truncated to just"no", producinginvalid security-opt: "no"on deployment.Changed the value capture group from
([^\s-]+)?to((?!--)[^\s]+)?— hyphens within values are now preserved while--flagboundaries are still correctly detected via negative lookahead.Issues
Category
Preview
N/A — backend logic change, no UI changes.
AI Assistance
If AI was used:
Testing
./vendor/bin/pest tests/Feature/DockerCustomCommandsTest.php # 27 passed (32 assertions) — 22 existing + 5 newNew test cases:
--security-opt no-new-privileges:true(space syntax)--security-opt=no-new-privileges:true(equals syntax)--security-opt apparmor:unconfined(non-hyphenated value, regression check)--cap-drop ALL --security-opt no-new-privileges:true(combined options)--sysctl net.ipv4.ip-forward=1(another hyphenated value option)Contributor Agreement
Important