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

🐛 Regex to avoid substring matching on route paths #1337

Merged
merged 2 commits into from
Sep 11, 2023

Conversation

ibolton336
Copy link
Member

@ibolton336 ibolton336 commented Sep 7, 2023

This updates the formatPath function to use a regex pattern that matches :k followed by either a / or the end of the string ($). This way, it won't inadvertently replace parts of other placeholders.

Resolves #1335

Copy link
Collaborator

@mturley mturley left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks

@sjd78
Copy link
Member

sjd78 commented Sep 7, 2023

No unit test?! 😉

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.10% 🎉

Comparison is base (2a4eb97) 42.58% compared to head (71cdc3f) 42.69%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1337      +/-   ##
==========================================
+ Coverage   42.58%   42.69%   +0.10%     
==========================================
  Files         136      136              
  Lines        4222     4223       +1     
  Branches     1000     1000              
==========================================
+ Hits         1798     1803       +5     
+ Misses       2412     2408       -4     
  Partials       12       12              
Flag Coverage Δ
client 42.69% <100.00%> (+0.10%) ⬆️
server ∅ <ø> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
client/src/app/Paths.ts 100.00% <ø> (+9.09%) ⬆️
client/src/app/utils/utils.ts 70.96% <100.00%> (+3.11%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: ibolton336 <ibolton@redhat.com>
Signed-off-by: ibolton336 <ibolton@redhat.com>
@ibolton336
Copy link
Member Author

No unit test?! 😉

Added some and moved the util to the utils file.

Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

formatPath helper breaks if some params are substrings of others
3 participants