Skip to content

Commit 944692c

Browse files
authored
Merge pull request #808 from topcoder-platform/PM-1207
PM- 1207 Copilot Opportunity details api is not public
2 parents 0f4db68 + d2aa3e9 commit 944692c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/routes/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ router.get(`/${apiVersion}/projects/health`, (req, res) => {
2525

2626
// List of public routes
2727
const publicRoutes = [
28-
`/${apiVersion}/projects/copilots/opportunities`,
29-
`/${apiVersion}/projects/copilot/opportunity/:id(\\d+)`,
28+
new RegExp(`^/${apiVersion}/projects/copilots/opportunities$`),
29+
new RegExp(`^/${apiVersion}/projects/copilot/opportunity/\\d+$`),
3030
];
3131

3232
// All project service endpoints need authentication
@@ -35,7 +35,7 @@ const jwtAuth = require('tc-core-library-js').middleware.jwtAuthenticator;
3535
router.all(
3636
RegExp(`\\/${apiVersion}\\/(copilots|projects|timelines|orgConfig|customer-payments)(?!\\/health).*`),
3737
(req, res, next) => {
38-
if (publicRoutes.some(route => req.path.match(new RegExp(`^${route}$`)))) {
38+
if (publicRoutes.some(routeRegex => routeRegex.test(req.path))) {
3939
return next();
4040
}
4141
// JWT authentication

0 commit comments

Comments
 (0)