Răsfoiți Sursa

tidy up type

Yuki Takei 1 an în urmă
părinte
comite
a1a32f2631
1 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 2 2
      packages/remark-attachment-refs/src/server/routes/refs.ts

+ 2 - 2
packages/remark-attachment-refs/src/server/routes/refs.ts

@@ -139,7 +139,7 @@ export const routesFactory = (crowi): any => {
   router.get('/refs', accessTokenParser, loginRequired, async(req: RequestWithUser, res) => {
   router.get('/refs', accessTokenParser, loginRequired, async(req: RequestWithUser, res) => {
     const user = req.user;
     const user = req.user;
     const { prefix, pagePath } = req.query;
     const { prefix, pagePath } = req.query;
-    const options = JSON.parse(req.query.options?.toString() ?? '');
+    const options: Record<string, string | undefined> = JSON.parse(req.query.options?.toString() ?? '');
 
 
     // check either 'prefix' or 'pagePath ' is specified
     // check either 'prefix' or 'pagePath ' is specified
     if (prefix == null && pagePath == null) {
     if (prefix == null && pagePath == null) {
@@ -149,7 +149,7 @@ export const routesFactory = (crowi): any => {
 
 
     // check regex
     // check regex
     let regex: RegExp | null = null;
     let regex: RegExp | null = null;
-    const regexOptionValue = options.regexp || options.regex;
+    const regexOptionValue = options.regexp ?? options.regex;
     if (regexOptionValue != null) {
     if (regexOptionValue != null) {
       // check the length to avoid ReDoS
       // check the length to avoid ReDoS
       if (regexOptionValue.length > 400) {
       if (regexOptionValue.length > 400) {