Skip to content

Node.js based forum software built for the modern web

feat: normalize paths before comparison

Julian Lamdf8d62ba06da
diff --git a/public/openapi/read.yaml b/public/openapi/read.yaml
index 94481e01ba..f60727f0e9 100644
--- a/public/openapi/read.yaml
+++ b/public/openapi/read.yaml
@@ -225,7 +225,7 @@ paths:
$ref: 'read/me.yaml'
/api/me/*:
$ref: 'read/me.yaml'
- "/api/uid/{uid}/*":
+ "/api/uid/{uid*}":
$ref: 'read/uid/uid.yaml'
"/api/user/{userslug}":
$ref: 'read/user/userslug.yaml'
diff --git a/test/api.js b/test/api.js
index 141af73fb2..9a1f6292f5 100644
--- a/test/api.js
+++ b/test/api.js
@@ -187,7 +187,10 @@ describe('API', async () => {
return paths;
};
- const paths = buildPaths(webserver.app._router.stack);
+ const paths = buildPaths(webserver.app._router.stack).map(function normalize(pathObj) {
+ pathObj.path = pathObj.path.replace(/\/:([^\\/]+)/g, '/{$1}');
+ return pathObj;
+ });
// For each express path, query for existence in read and write api schemas
paths.forEach((pathObj) => {