Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent match in between the string #202

Merged
merged 1 commit into from
Jun 15, 2021
Merged

Conversation

grappler
Copy link
Contributor

Prevent project.com from matching with project.com.example.com

Prevent project.com from matching with project.com.example.com
@seanhamlin seanhamlin requested review from bomoko and removed request for seanhamlin June 10, 2021 08:30
@bomoko
Copy link
Contributor

bomoko commented Jun 14, 2021

Great - I've checked this out. It should do what's advertised.

Testing the logic in a couple Lua scripts - without the fix, the following will match successfully

hostname = "project.com"
LAGOON_AUTOGENERATED_ROUTES = "project.com.example.com"
host = string.gsub(hostname, "%p", "%%%1")
io.write(string.match(LAGOON_AUTOGENERATED_ROUTES, host))

with the fix, the write will fail, since the match is nil

hostname = "project.com"
LAGOON_AUTOGENERATED_ROUTES = "project.com.example.com"
host = string.gsub(hostname, "%p", "%%%1")
io.write(string.match(LAGOON_AUTOGENERATED_ROUTES,host.."$"))

Copy link
Contributor

@bomoko bomoko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tobybellwood tobybellwood merged commit fa66ec8 into uselagoon:main Jun 15, 2021
@grappler grappler deleted the patch-1 branch June 15, 2021 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants