Skip to content

Commit

Permalink
[8.x] Fix Code Scanning Alert #1292 (#202125) (#202292)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [Fix Code Scanning Alert #1292
(#202125)](#202125)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Alejandro Fernández
Haro","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-29T12:35:49Z","message":"Fix
Code Scanning Alert #1292 (#202125)\n\n## Summary\n\nResolves
[#1292](https://github.com/elastic/kibana-team/issues/1292)\n\n\n###
Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"841d052776e5e9e703ce69f0161bc21e49446792","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor"],"title":"Fix
Code Scanning Alert
#1292","number":202125,"url":"https://github.com/elastic/kibana/pull/202125","mergeCommit":{"message":"Fix
Code Scanning Alert #1292 (#202125)\n\n## Summary\n\nResolves
[#1292](https://github.com/elastic/kibana-team/issues/1292)\n\n\n###
Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"841d052776e5e9e703ce69f0161bc21e49446792"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202125","number":202125,"mergeCommit":{"message":"Fix
Code Scanning Alert #1292 (#202125)\n\n## Summary\n\nResolves
[#1292](https://github.com/elastic/kibana-team/issues/1292)\n\n\n###
Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"841d052776e5e9e703ce69f0161bc21e49446792"}}]}]
BACKPORT-->

Co-authored-by: Alejandro Fernández Haro <[email protected]>
  • Loading branch information
kibanamachine and afharo authored Nov 29, 2024
1 parent 5036fd6 commit ece4625
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/kbn-router-to-openapispec/src/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ describe('assignToPaths', () => {
assignToPaths(paths, '/foo', {});
assignToPaths(paths, '/bar/{id?}', {});
assignToPaths(paths, '/bar/file/{path*}', {});
assignToPaths(paths, '/bar/file/{path*}/{id?}', {});
expect(paths).toEqual({
'/foo': {},
'/bar/{id}': {},
'/bar/file/{path}': {},
'/bar/file/{path}/{id}': {},
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-router-to-openapispec/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export const assignToPaths = (
path: string,
pathObject: OpenAPIV3.PathItemObject
): void => {
const pathName = path.replace(/[\?\*]/, '');
const pathName = path.replace(/[\?\*]/g, '');
paths[pathName] = { ...paths[pathName], ...pathObject };
};

Expand Down

0 comments on commit ece4625

Please sign in to comment.