Skip to content

Commit

Permalink
Fix Code Scanning Alert elastic#1292 (elastic#202125)
Browse files Browse the repository at this point in the history
## Summary

Resolves [elastic#1292](elastic/kibana-team#1292)


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
  • Loading branch information
afharo authored Nov 29, 2024
1 parent 02e9ee4 commit 841d052
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 841d052

Please sign in to comment.